From 6900497fc33e909604d69293b1f86ad1b2f82430 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Fri, 8 May 2026 15:17:17 -0500 Subject: [PATCH 01/28] java: add cuopt-java skeleton with FFM bridge demo Adds the initial directory structure for a Java interface to cuOpt under java/, modeled after cuvs-java's architecture (Project Panama / FFM, Java 21 base API + Java 22 multi-release JAR for FFM impl). The first end-to-end demo is Solver.getVersion(), which exercises the full FFM bridge: Java 21 public API -> ServiceLoader SPI -> Java 22 FFM implementation -> jextract panama bindings -> libcuopt.so. Full LP/MILP/QP support lands in subsequent PRs. Build setup encodes three lessons from cuvs-java: - Java 21 base API + Java 22 multi-release JAR for FFM (cuvs Issue #1066) - maven-compiler-plugin 3.11.0+ with serial phase bindings (#1293) - Spotless under only when added (#1090) Per-folder READMEs explain the role of each layer in the architecture. Adds build_java group and test_java file definition to dependencies.yaml so conda-forge openjdk + maven dependencies flow into developer envs. Toolchain prerequisites for local build (not auto-installed): - conda install -c conda-forge openjdk=22 maven - jextract from https://jdk.java.net/jextract/ --- dependencies.yaml | 17 +++ java/.gitignore | 27 ++++ java/README.md | 99 +++++++++++++ java/build.sh | 102 +++++++++++++ java/cuopt-java/README.md | 41 ++++++ java/cuopt-java/pom.xml | 138 ++++++++++++++++++ .../java/com/nvidia/cuopt/CuOptException.java | 27 ++++ .../src/main/java/com/nvidia/cuopt/README.md | 34 +++++ .../main/java/com/nvidia/cuopt/Solver.java | 32 ++++ .../com/nvidia/cuopt/spi/CuOptProvider.java | 57 ++++++++ .../main/java22/com/nvidia/cuopt/README.md | 29 ++++ .../cuopt/internal/CuOptProviderImpl.java | 49 +++++++ .../cuopt/internal/NativeLibraryLoader.java | 101 +++++++++++++ .../cuopt/supported-platforms.properties | 11 ++ .../com.nvidia.cuopt.spi.CuOptProvider | 1 + .../java/com/nvidia/cuopt/SolverTest.java | 21 +++ java/license-header.txt | 4 + java/panama-bindings/README.md | 34 +++++ java/panama-bindings/generate-bindings.sh | 60 ++++++++ java/panama-bindings/headers.h | 9 ++ 20 files changed, 893 insertions(+) create mode 100644 java/.gitignore create mode 100644 java/README.md create mode 100755 java/build.sh create mode 100644 java/cuopt-java/README.md create mode 100644 java/cuopt-java/pom.xml create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOptException.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/README.md create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java create mode 100644 java/cuopt-java/src/main/java22/com/nvidia/cuopt/README.md create mode 100644 java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java create mode 100644 java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java create mode 100644 java/cuopt-java/src/main/resources/META-INF/cuopt/supported-platforms.properties create mode 100644 java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.CuOptProvider create mode 100644 java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverTest.java create mode 100644 java/license-header.txt create mode 100644 java/panama-bindings/README.md create mode 100755 java/panama-bindings/generate-bindings.sh create mode 100644 java/panama-bindings/headers.h diff --git a/dependencies.yaml b/dependencies.yaml index 68afb4f7f5..f3a5b2631b 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -45,6 +45,12 @@ files: - test_cpp - test_cpp_cuopt - depends_on_libcuopt + test_java: + output: none + includes: + - cuda_version + - build_java + - depends_on_libcuopt test_python: output: none includes: @@ -313,6 +319,17 @@ dependencies: - output_types: [conda] packages: - cuda-sanitizer-api + build_java: + common: + - output_types: [conda] + packages: + # Java 22 is the minimum for FFM final (no preview flag). + # Public API compiles to Java 21 release; runtime requires Java 22+. + # See java/README.md for the full multi-release-JAR rationale. + - openjdk=22 + - maven>=3.9.6 + # jextract is not available on conda-forge; java/build.sh expects + # it to be installed manually. See java/README.md. test_cpp_cuopt: common: - output_types: [conda] diff --git a/java/.gitignore b/java/.gitignore new file mode 100644 index 0000000000..2b0a431766 --- /dev/null +++ b/java/.gitignore @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Maven build output +target/ +*.class +.mvn/ + +# IDE +.idea/ +*.iml +.classpath +.project +.settings/ +.factorypath +.vscode/ + +# Logs +*.log + +# OS +.DS_Store +Thumbs.db + +# NOTE: panama bindings under +# cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/ +# ARE committed (cuvs convention) — the drift gate in build.sh enforces this. diff --git a/java/README.md b/java/README.md new file mode 100644 index 0000000000..927a6b05e8 --- /dev/null +++ b/java/README.md @@ -0,0 +1,99 @@ +# cuopt-java + +Java interface to NVIDIA cuOpt for Linear Programming (LP), Mixed-Integer +Linear Programming (MILP), and Quadratic Programming (QP). + +This directory contains the source for the `com.nvidia.cuopt:cuopt-java` +Maven artifact. + +## Status + +This is the initial skeleton. The first end-to-end demo (`Solver.getVersion()`) +proves the FFM bridge from Java to `libcuopt.so` works. The full LP / MILP / QP +public API will land in subsequent PRs. + +## Architecture (5 layers) + +``` +Layer 5 Public API (Java 21) src/main/java/com/nvidia/cuopt/ + ▼ ServiceLoader / SPI +Layer 4 CuOptProvider (sealed) src/main/java/.../spi/ + ▼ resolved to java22 impl on Java 22+ JVMs +Layer 3 FFM Implementation src/main/java22/.../internal/ + (Java 22) Owns Arena.ofConfined(), MemorySegment + ▼ +Layer 2 Panama Bindings src/main/java22/.../internal/panama/ + (jextract output) Generated; never edited by hand + ▼ MethodHandle.invokeExact (no JNI) +Layer 1 Native library libcuopt.so (cpp/build/) + cpp/include/cuopt/linear_programming/cuopt_c.h +``` + +The public API (Layer 5) compiles to **Java 21 release** so the JAR can be +loaded on Java 21 classpaths at compile time. The FFM implementation (Layer 3) +uses `java.lang.foreign.*` types which require **Java 22 runtime**. The +multi-release JAR resolves the right classes at runtime via the JVM's +`META-INF/versions/22/` lookup. + +The SPI bridge (Layer 4) exists because Layer 5 cannot reference `MemorySegment` +or other Java 22 types in its method signatures (those classes don't exist in +Java 21). `CuOptProvider` is a Java-21-compatible interface that +`ServiceLoader` resolves to the Java 22 implementation at runtime. + +## Layout + +``` +java/ +├── README.md (this file) +├── build.sh Top-level entry point — auto-downloads +│ jextract, regenerates bindings, runs mvn. +├── license-header.txt Apache 2.0 SPDX header for source files. +├── cuopt-java/ The published Maven artifact. +│ ├── pom.xml Java 21 + Java 22 MR-JAR config. +│ └── src/ +│ ├── main/java/ Java 21 public API. +│ ├── main/java22/ Java 22 FFM implementation. +│ ├── main/resources/ ServiceLoader registration; platform table. +│ └── test/java/ JUnit 5 tests. +└── panama-bindings/ jextract binding generation. + ├── headers.h Umbrella include of cuopt_c.h. + └── generate-bindings.sh jextract invocation. +``` + +## Building (developer workstation) + +Prerequisites: + +- JDK 22+ (`conda install -c conda-forge openjdk=22`) +- Maven 3.9.6+ (`conda install -c conda-forge maven`) +- A built `libcuopt.so` (from `../cpp/build/`) + +```bash +# Build libcuopt.so first if not already built +cd /path/to/cuopt +./build.sh libcuopt + +# Then build the Java side (auto-downloads jextract on first run) +./java/build.sh +``` + +This regenerates panama bindings from `cpp/include/cuopt/linear_programming/cuopt_c.h`, +then runs `mvn clean verify`. Output JARs land in `java/cuopt-java/target/`. + +## Per-folder design notes + +Each directory under `java/` has its own `README.md` explaining the role +of that layer in the architecture. Read them in this order if you want +the full picture: + +1. `cuopt-java/README.md` — the published artifact +2. `cuopt-java/src/main/java/com/nvidia/cuopt/README.md` — Layer 5 public API +3. `cuopt-java/src/main/java22/com/nvidia/cuopt/README.md` — Layers 3 + 2 (FFM impl + panama) +4. `panama-bindings/README.md` — binding generation pipeline + +## References + +- C API header: `cpp/include/cuopt/linear_programming/cuopt_c.h` +- cuvs-java reference: https://github.com/rapidsai/cuvs/tree/main/java +- jextract: https://github.com/openjdk/jextract +- JEP 454 (FFM Final): https://openjdk.org/jeps/454 diff --git a/java/build.sh b/java/build.sh new file mode 100755 index 0000000000..980ffbf936 --- /dev/null +++ b/java/build.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Build entry point for cuopt-java. +# +# Pipeline: +# 1. Verify JDK 22 + Maven 3.9.6+ are available. +# 2. Verify libcuopt.so is reachable. +# 3. Run panama-bindings/generate-bindings.sh (regenerates jextract output). +# 4. Run drift gate: 'git diff --exit-code' on the generated panama dir +# forces commit of any changes. +# 5. Run 'mvn clean verify'. +# +# Environment variables (all optional): +# JEXTRACT Path to jextract binary. Default: search PATH. +# CUOPT_INCLUDE Path to cuopt include dir. Default: ../cpp/include. +# CUDA_INCLUDE Path to CUDA include dir. Default: /usr/local/cuda/include. +# CMAKE_PREFIX_PATH Prepended to LD_LIBRARY_PATH so libcuopt.so is found. +# Default: ../cpp/build. +# SKIP_DRIFT_CHECK If set to 'true', skips the panama drift gate. +# Useful in initial-bootstrap commits before the +# bindings are first committed. +# SKIP_TESTS If set to 'true', runs 'mvn package' instead of +# 'mvn verify'. + +set -euo pipefail + +CURDIR="$(cd "$(dirname "$0")" && pwd)" +REPODIR="$(cd "${CURDIR}/.." && pwd)" + +JEXTRACT="${JEXTRACT:-jextract}" +CUOPT_INCLUDE="${CUOPT_INCLUDE:-${REPODIR}/cpp/include}" +CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH:-${REPODIR}/cpp/build}" + +echo "==> cuopt-java build" +echo " REPODIR=${REPODIR}" +echo " JEXTRACT=${JEXTRACT}" +echo " CUOPT_INCLUDE=${CUOPT_INCLUDE}" +echo " CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" + +# 1. Toolchain checks +if ! command -v java >/dev/null 2>&1; then + echo "ERROR: java not found in PATH." >&2 + exit 1 +fi +JAVA_VERSION="$(java -version 2>&1 | head -1 | sed -E 's/.*"([0-9]+).*/\1/')" +if [[ -z "${JAVA_VERSION}" || "${JAVA_VERSION}" -lt 22 ]]; then + echo "ERROR: cuopt-java requires JDK 22 or higher (got: $(java -version 2>&1 | head -1))." >&2 + echo " Install with: conda install -c conda-forge openjdk=22" >&2 + exit 1 +fi + +if ! command -v mvn >/dev/null 2>&1; then + echo "ERROR: mvn not found in PATH." >&2 + echo " Install with: conda install -c conda-forge maven" >&2 + exit 1 +fi + +if ! command -v "${JEXTRACT}" >/dev/null 2>&1; then + echo "ERROR: jextract not found at '${JEXTRACT}'." >&2 + echo " Download jextract for JDK 22 from:" >&2 + echo " https://jdk.java.net/jextract/" >&2 + echo " Then set JEXTRACT to the binary path, or add it to PATH." >&2 + exit 1 +fi + +# 2. libcuopt.so check +if [[ ! -f "${CMAKE_PREFIX_PATH}/libcuopt.so" ]]; then + echo "WARNING: libcuopt.so not found at ${CMAKE_PREFIX_PATH}/libcuopt.so" >&2 + echo " Tests will fail unless libcuopt is on java.library.path." >&2 +fi +export LD_LIBRARY_PATH="${CMAKE_PREFIX_PATH}:${LD_LIBRARY_PATH:-}" + +# 3. Regenerate panama bindings +echo "==> Regenerating panama bindings" +"${CURDIR}/panama-bindings/generate-bindings.sh" + +# 4. Drift gate +if [[ "${SKIP_DRIFT_CHECK:-false}" != "true" ]]; then + echo "==> Checking for panama bindings drift" + PANAMA_REL="java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama" + if ! git -C "${REPODIR}" diff --quiet -- "${PANAMA_REL}" 2>/dev/null; then + echo "ERROR: Panama bindings drifted from committed state." >&2 + echo " Run './java/build.sh' and commit the regenerated files at:" >&2 + echo " ${PANAMA_REL}/" >&2 + echo " (Use SKIP_DRIFT_CHECK=true to bypass during initial bootstrap.)" >&2 + git -C "${REPODIR}" diff --stat -- "${PANAMA_REL}" >&2 + exit 1 + fi +fi + +# 5. Maven build +echo "==> Running Maven" +cd "${CURDIR}/cuopt-java" +if [[ "${SKIP_TESTS:-false}" == "true" ]]; then + mvn clean package -DskipTests +else + mvn clean verify -Djava.library.path="${CMAKE_PREFIX_PATH}" +fi + +echo "==> cuopt-java build complete" diff --git a/java/cuopt-java/README.md b/java/cuopt-java/README.md new file mode 100644 index 0000000000..7549c55b70 --- /dev/null +++ b/java/cuopt-java/README.md @@ -0,0 +1,41 @@ +# cuopt-java (Maven artifact) + +Source for the published `com.nvidia.cuopt:cuopt-java` artifact. + +## Build setup highlights + +The `pom.xml` encodes three lessons from cuvs-java: + +- **Java 21 base + Java 22 multi-release JAR** (cuvs Issue #1066): the + default-compile execution targets `21`; a separate + `compile-java-22` execution targets `22` and writes + to the `META-INF/versions/22/` section of the JAR via + `multiReleaseOutput=true`. + +- **`maven-compiler-plugin` 3.11.0+ with explicit phase bindings** + (cuvs Issue #1293): the two compile executions are bound to the + `compile` and `process-classes` lifecycle phases respectively, so they + run **serially** rather than in parallel. Without this, ~50% of builds + fail with phantom "cannot find symbol" errors as the java22 compile + starts before the java21 compile finishes. + +- **Spotless in `` only** (cuvs Issue #1090): never list + spotless under `` — that pulls spotless code into a + fat JAR with multiple `module-info.class` files, breaking modularized + consumers. + +## Layout + +``` +cuopt-java/ +├── pom.xml +└── src/ + ├── main/ + │ ├── java/ ← Java 21 public API (Layer 5) + │ ├── java22/ ← Java 22 FFM impl (Layers 3 + 2) + │ └── resources/META-INF/ + │ ├── cuopt/supported-platforms.properties ← data-driven platform check + │ └── services/ ← ServiceLoader registration + └── test/ + └── java/ ← JUnit 5 +``` diff --git a/java/cuopt-java/pom.xml b/java/cuopt-java/pom.xml new file mode 100644 index 0000000000..e6b5009bae --- /dev/null +++ b/java/cuopt-java/pom.xml @@ -0,0 +1,138 @@ + + + + 4.0.0 + + com.nvidia.cuopt + cuopt-java + 26.6.0-SNAPSHOT + jar + + cuopt-java + Java interface to NVIDIA cuOpt for LP, MILP, and QP. + https://github.com/NVIDIA/cuopt + + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + + 22 + 22 + + 5.11.4 + + + + + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.jupiter.version} + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + default-compile + compile + + compile + + + 21 + + ${project.basedir}/src/main/java + + + + + compile-java-22 + process-classes + + compile + + + 22 + + ${project.basedir}/src/main/java22 + + true + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.4.2 + + + + true + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.5.2 + + --enable-native-access=ALL-UNNAMED + + + + + diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOptException.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOptException.java new file mode 100644 index 0000000000..cd5e908f3c --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOptException.java @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt; + +/** + * Unchecked exception thrown by cuopt-java when a native call fails or + * the runtime environment is misconfigured (e.g., the native library + * cannot be loaded, or the JVM is older than Java 22). + */ +public class CuOptException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public CuOptException(String message) { + super(message); + } + + public CuOptException(String message, Throwable cause) { + super(message, cause); + } + + public CuOptException(Throwable cause) { + super(cause); + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/README.md b/java/cuopt-java/src/main/java/com/nvidia/cuopt/README.md new file mode 100644 index 0000000000..6c7e6498c7 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/README.md @@ -0,0 +1,34 @@ +# Layer 5 — Public API (Java 21) + +This package compiles to **Java 21 release**. Code here cannot reference +`java.lang.foreign.*` types (`MemorySegment`, `Arena`, etc.) because those +classes don't exist in Java 21. + +## What lives here + +- The user-facing API: `Solver` (currently exposes `getVersion()` only; + `Problem`, `Variable`, `LinearExpr`, etc. land in subsequent PRs). +- Public exceptions: `CuOptException`. +- The SPI interface (`spi/CuOptProvider.java`) — sealed; permits only the + Java 22 implementation in `internal/`. + +## How calls reach the FFM implementation + +Layer 5 calls the SPI: + +```java +public final class Solver { + public static String getVersion() { + return CuOptProvider.instance().getVersion(); + } +} +``` + +`CuOptProvider.instance()` uses `java.util.ServiceLoader` to find the +implementation registered in `META-INF/services/`. On a Java 22+ JVM, +the registered class lives in `META-INF/versions/22/com/nvidia/cuopt/internal/` +(the multi-release JAR layer), so the JVM picks it up automatically. + +On a Java 21 JVM the implementation class is missing entirely, and +`ServiceLoader.findFirst()` returns empty. We throw a clear error in +that case — the JAR loads at compile time but cannot run. diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java new file mode 100644 index 0000000000..2da4545fc8 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java @@ -0,0 +1,32 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt; + +import com.nvidia.cuopt.spi.CuOptProvider; + +/** + * Entry point for cuopt-java. + * + *

This class currently exposes only {@link #getVersion()} as a + * minimal end-to-end demonstration of the FFM bridge. The full LP / + * MILP / QP API ({@code Problem}, {@code Variable}, {@code LinearExpr}, + * etc.) lands in subsequent PRs. + */ +public final class Solver { + + private Solver() {} + + /** + * Returns the cuOpt library version (from {@code libcuopt.so}) as a + * human-readable string. + * + * @throws CuOptException if the native library cannot be loaded or + * the FFM implementation is missing (e.g., + * running on Java 21). + */ + public static String getVersion() { + return CuOptProvider.instance().getVersion(); + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java new file mode 100644 index 0000000000..d262876e3b --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java @@ -0,0 +1,57 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.spi; + +import com.nvidia.cuopt.CuOptException; +import java.util.ServiceLoader; + +/** + * Service provider interface bridging the Java 21 public API to the + * Java 22 FFM implementation. + * + *

This interface compiles to Java 21 release. Method signatures use + * only Java 21-compatible types (no {@code MemorySegment}, no + * {@code Arena}). The implementation lives in + * {@code com.nvidia.cuopt.internal.CuOptProviderImpl} under + * {@code src/main/java22/}; the JVM resolves it via + * {@link java.util.ServiceLoader} on Java 22+ runtimes. + * + *

This interface is sealed — third parties cannot provide alternative + * implementations. + */ +public interface CuOptProvider { + + /** + * Returns the cuOpt library version as a human-readable string in + * {@code major.minor.patch} format. + */ + String getVersion(); + + /** + * Returns the singleton implementation, resolved via + * {@link ServiceLoader}. + * + * @throws CuOptException if no implementation is registered + * (e.g., running on Java 21 — the FFM + * impl lives in the Java 22 multi-release + * layer and is not visible to Java 21 JVMs). + */ + static CuOptProvider instance() { + return Holder.INSTANCE; + } + + final class Holder { + private static final CuOptProvider INSTANCE = ServiceLoader + .load(CuOptProvider.class) + .findFirst() + .orElseThrow(() -> new CuOptException( + "No CuOptProvider implementation found. cuopt-java requires " + + "Java 22 or higher at runtime; the FFM implementation lives " + + "in the Java 22 multi-release layer of the JAR and is not " + + "visible to Java 21 JVMs.")); + + private Holder() {} + } +} diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/README.md b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/README.md new file mode 100644 index 0000000000..58dc3d666a --- /dev/null +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/README.md @@ -0,0 +1,29 @@ +# Layers 3 + 2 — FFM Implementation and Panama Bindings (Java 22) + +Code in this directory compiles to **Java 22 release** and lives in +`META-INF/versions/22/` of the published JAR. It only loads on JVMs at +Java 22 or higher. + +## Layer 3 — FFM Implementation (`internal/`) + +- `CuOptProviderImpl` — the SPI implementation. Bridges Layer 5's public + API to the panama bindings. +- `NativeLibraryLoader` — loads `libcuopt.so` (or `.dll`/`.dylib`). + Reads `META-INF/cuopt/supported-platforms.properties` for the platform + table; falls back to `java.library.path` if the lib isn't bundled in + the JAR. + +Each native-handle-owning class will hold its own `Arena.ofConfined()` +when full LP / MILP / QP support lands. For the current `getVersion()` +demo, the only allocations are short-lived per-call segments. + +## Layer 2 — Panama Bindings (`internal/panama/`) + +Generated by `jextract` from `cpp/include/cuopt/linear_programming/cuopt_c.h`. +**Never edited by hand.** Regenerated on every build by +`../../../panama-bindings/generate-bindings.sh`. + +A drift gate in `build.sh` runs `git diff --exit-code` after +regeneration — any drift between the generated output and the committed +files fails the build, forcing a deliberate commit of the regenerated +bindings. diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java new file mode 100644 index 0000000000..03fde9e3f3 --- /dev/null +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java @@ -0,0 +1,49 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.internal; + +import com.nvidia.cuopt.CuOptException; +import com.nvidia.cuopt.internal.panama.cuopt_c_h; +import com.nvidia.cuopt.spi.CuOptProvider; +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; + +/** + * FFM-based implementation of {@link CuOptProvider}. + * + *

Registered via {@code META-INF/services/com.nvidia.cuopt.spi.CuOptProvider}. + * Lives in the Java 22 multi-release layer of the JAR; loaded only on + * JVMs at Java 22 or higher. + */ +public final class CuOptProviderImpl implements CuOptProvider { + + /** + * No-arg constructor required for {@link java.util.ServiceLoader}. + * Eagerly loads the native library so a misconfigured runtime fails + * fast at provider creation rather than on the first call. + */ + public CuOptProviderImpl() { + NativeLibraryLoader.ensureLoaded(); + } + + @Override + public String getVersion() { + try (Arena arena = Arena.ofConfined()) { + MemorySegment major = arena.allocate(ValueLayout.JAVA_INT); + MemorySegment minor = arena.allocate(ValueLayout.JAVA_INT); + MemorySegment patch = arena.allocate(ValueLayout.JAVA_INT); + + int rc = cuopt_c_h.cuOptGetVersion(major, minor, patch); + if (rc != 0) { + throw new CuOptException( + "cuOptGetVersion returned non-zero status: " + rc); + } + return major.get(ValueLayout.JAVA_INT, 0) + + "." + minor.get(ValueLayout.JAVA_INT, 0) + + "." + patch.get(ValueLayout.JAVA_INT, 0); + } + } +} diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java new file mode 100644 index 0000000000..5fb723d8e1 --- /dev/null +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java @@ -0,0 +1,101 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.internal; + +import com.nvidia.cuopt.CuOptException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.Locale; +import java.util.Properties; + +/** + * Loads {@code libcuopt.so} (or the platform equivalent) on first use. + * + *

Resolution order: + *

    + *
  1. If {@code libcuopt} is on {@code java.library.path}, use it + * (typical conda / system install).
  2. + *
  3. Otherwise, look for an embedded copy at + * {@code META-INF/native//libcuopt.so} inside the JAR + * (classifier-JAR install path; not yet implemented in this + * skeleton).
  4. + *
+ * + *

The platform table at + * {@code META-INF/cuopt/supported-platforms.properties} controls which + * OS+arch combinations are accepted — adding arm64 support is a + * properties-file edit, not a code change. + */ +final class NativeLibraryLoader { + + private static final String PLATFORM_PROPS = + "/META-INF/cuopt/supported-platforms.properties"; + + private static volatile boolean loaded = false; + + private NativeLibraryLoader() {} + + /** + * Idempotent load of {@code libcuopt}. Safe to call from multiple threads. + */ + static synchronized void ensureLoaded() { + if (loaded) { + return; + } + verifyPlatformSupported(); + try { + // Prefer java.library.path (conda / system install). + System.loadLibrary("cuopt"); + } catch (UnsatisfiedLinkError e) { + // TODO: extract from META-INF/native//libcuopt.so once + // classifier JARs are wired up. For now, surface a clear error. + throw new CuOptException( + "Failed to load libcuopt. Either add the directory containing " + + "libcuopt.so (or .dll/.dylib) to java.library.path, or rely " + + "on a future classifier JAR that bundles the native library.", + e); + } + loaded = true; + } + + private static void verifyPlatformSupported() { + String os = System.getProperty("os.name", "").toLowerCase(Locale.ROOT); + String arch = System.getProperty("os.arch", "").toLowerCase(Locale.ROOT); + String key = osKey(os) + "-" + archKey(arch); + + Properties props = new Properties(); + try (InputStream in = NativeLibraryLoader.class.getResourceAsStream(PLATFORM_PROPS)) { + if (in == null) { + throw new CuOptException( + "Internal error: " + PLATFORM_PROPS + " not found in JAR."); + } + props.load(in); + } catch (IOException e) { + throw new CuOptException("Failed to read " + PLATFORM_PROPS, e); + } + + if (!"true".equalsIgnoreCase(props.getProperty(key))) { + throw new CuOptException( + "Unsupported platform: " + key + ". Supported platforms: " + + props.stringPropertyNames()); + } + } + + private static String osKey(String os) { + if (os.contains("linux")) return "linux"; + if (os.contains("mac") || os.contains("darwin")) return "macos"; + if (os.contains("win")) return "windows"; + return os; + } + + private static String archKey(String arch) { + if (arch.equals("amd64") || arch.equals("x86_64")) return "amd64"; + if (arch.equals("aarch64") || arch.equals("arm64")) return "aarch64"; + return arch; + } +} diff --git a/java/cuopt-java/src/main/resources/META-INF/cuopt/supported-platforms.properties b/java/cuopt-java/src/main/resources/META-INF/cuopt/supported-platforms.properties new file mode 100644 index 0000000000..04bf85bdfd --- /dev/null +++ b/java/cuopt-java/src/main/resources/META-INF/cuopt/supported-platforms.properties @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Supported (os, arch) combinations for cuopt-java. +# Adding arm64 support is a properties-file edit, not a code change. + +linux-amd64=true +linux-aarch64=false +macos-amd64=false +macos-aarch64=false +windows-amd64=false diff --git a/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.CuOptProvider b/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.CuOptProvider new file mode 100644 index 0000000000..058c2edc6e --- /dev/null +++ b/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.CuOptProvider @@ -0,0 +1 @@ +com.nvidia.cuopt.internal.CuOptProviderImpl diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverTest.java new file mode 100644 index 0000000000..6787761ca8 --- /dev/null +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverTest.java @@ -0,0 +1,21 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +class SolverTest { + + @Test + void getVersionReturnsNonEmptyString() { + String version = Solver.getVersion(); + assertNotNull(version); + assertTrue(version.matches("\\d+\\.\\d+\\.\\d+"), + "Expected version in 'major.minor.patch' format, got: " + version); + } +} diff --git a/java/license-header.txt b/java/license-header.txt new file mode 100644 index 0000000000..2c4220c33f --- /dev/null +++ b/java/license-header.txt @@ -0,0 +1,4 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) $YEAR$, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ diff --git a/java/panama-bindings/README.md b/java/panama-bindings/README.md new file mode 100644 index 0000000000..8ed1971912 --- /dev/null +++ b/java/panama-bindings/README.md @@ -0,0 +1,34 @@ +# panama-bindings — jextract binding generation + +This directory invokes [`jextract`](https://github.com/openjdk/jextract) +to generate Java bindings for cuOpt's C API. + +## Files + +- `headers.h` — umbrella include listing the C headers to bind. Currently + pulls in `cpp/include/cuopt/linear_programming/cuopt_c.h` and + `constants.h`. +- `generate-bindings.sh` — invokes `jextract` with the right flags. + Output goes to + `cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/`. + +## When this runs + +`build.sh` (one level up) runs this script on every build. The generated +files are committed to the repo so reviewers can see the binding surface +and IntelliJ can navigate to symbols. + +## Drift detection + +After regeneration, `build.sh` runs `git diff --exit-code` on the +generated directory. If `jextract` produces output that differs from +what's committed (e.g., because `cuopt_c.h` changed), the build fails +with a clear message asking the developer to commit the regenerated +files. This catches additive C API changes that the upstream +`check-c-abi` gate (planned in a follow-up PR) accepts as non-breaking. + +## Why we don't use a Maven plugin + +Running `jextract` from `mvn` (e.g., via `exec-maven-plugin`) would tie +binding regeneration to `mvn verify`, which developers may skip locally. +Running it from `build.sh` keeps it as a deliberate step. diff --git a/java/panama-bindings/generate-bindings.sh b/java/panama-bindings/generate-bindings.sh new file mode 100755 index 0000000000..40213dddbd --- /dev/null +++ b/java/panama-bindings/generate-bindings.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Regenerates Panama bindings for cuOpt's C API into +# cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/. +# +# Inputs: +# $JEXTRACT Path to the jextract binary (set by build.sh, or in PATH). +# $CUOPT_INCLUDE Path to cpp/include (defaults to ../../cpp/include). +# $CUDA_INCLUDE Path to CUDA include dir (defaults to /usr/local/cuda/include). +# +# Output: regenerates files under +# ../cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/ + +set -euo pipefail + +CURDIR="$(cd "$(dirname "$0")" && pwd)" +REPODIR="$(cd "${CURDIR}/../.." && pwd)" + +JEXTRACT="${JEXTRACT:-jextract}" +CUOPT_INCLUDE="${CUOPT_INCLUDE:-${REPODIR}/cpp/include}" +CUDA_INCLUDE="${CUDA_INCLUDE:-/usr/local/cuda/include}" + +OUTPUT_DIR="${REPODIR}/java/cuopt-java/src/main/java22" +TARGET_PACKAGE="com.nvidia.cuopt.internal.panama" + +# Sanity checks +if ! command -v "${JEXTRACT}" >/dev/null 2>&1; then + echo "ERROR: jextract not found at '${JEXTRACT}'." >&2 + echo " Run build.sh from the java/ directory to auto-download it," >&2 + echo " or set JEXTRACT to the path of an installed jextract binary." >&2 + exit 1 +fi + +if [[ ! -d "${CUOPT_INCLUDE}" ]]; then + echo "ERROR: cuopt include dir not found at '${CUOPT_INCLUDE}'." >&2 + exit 1 +fi + +# Clean previous output to ensure removed symbols are actually removed +PANAMA_DIR="${OUTPUT_DIR}/com/nvidia/cuopt/internal/panama" +mkdir -p "${PANAMA_DIR}" +find "${PANAMA_DIR}" -name '*.java' -delete 2>/dev/null || true + +# Run jextract +# --library cuopt: the generated code dlopen's libcuopt.so +# --target-package: where the generated classes land +# --output: source directory for generated files +# --include-dir: search paths for #include resolution +"${JEXTRACT}" \ + --include-dir "${CUOPT_INCLUDE}" \ + --include-dir "${CUDA_INCLUDE}" \ + --output "${OUTPUT_DIR}" \ + --target-package "${TARGET_PACKAGE}" \ + --library cuopt \ + "${CURDIR}/headers.h" + +echo "Panama bindings regenerated at:" +echo " ${PANAMA_DIR}" diff --git a/java/panama-bindings/headers.h b/java/panama-bindings/headers.h new file mode 100644 index 0000000000..2a54eb4161 --- /dev/null +++ b/java/panama-bindings/headers.h @@ -0,0 +1,9 @@ +/* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Umbrella header for jextract. Adding a new C header here exposes its + * symbols to the Java bindings. + */ + +#include +#include From 81ed6f31deb0454030bda87476f80e8a6d08e6e6 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Fri, 8 May 2026 16:02:51 -0500 Subject: [PATCH 02/28] java/ci: add CI workflows and complete dependencies.yaml integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds on the prior commit by: 1. Renaming the dependency group `build_java` -> `java` to match cuvs convention, and adding it to the `all` file's includes so all conda/environments/all_cuda-*_arch-*.yaml files now ship with openjdk=22.* and maven>=3.9.6. 2. Adding ci/build_java.sh and ci/test_java.sh, mirroring cuvs's pattern. ci/test_java.sh is a thin wrapper that delegates to ci/build_java.sh --run-java-tests. Splitting build/test into separate jobs is deferred (matches cuvs Issue #868) — requires shared-workflow surface for cross-job artifact passing. 3. Adding .github/workflows/pr.yaml jobs: - test_java paths group in changed-files - conda-java-build-and-tests-matrix (compute-matrix; amd64-only) - conda-java-build-and-tests (custom-job; gpu-l4-latest-1) - Adds conda-java-build-and-tests to pr-builder.needs 4. Adding java-build job to .github/workflows/build.yaml so main / release-branch / tag pushes produce cuopt-java JAR artifacts. CI will fail on this PR until two follow-up steps: - jextract is added to the rapidsai/ci-conda CI image (or pulled in ci/build_java.sh) - Generated panama bindings under java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/ are committed (initial bootstrap; runs on a workstation with JDK 22 + jextract installed locally) --- .github/workflows/build.yaml | 18 +++++ .github/workflows/pr.yaml | 42 ++++++++++ ci/build_java.sh | 81 +++++++++++++++++++ ci/test_java.sh | 31 +++++++ .../all_cuda-129_arch-aarch64.yaml | 2 + .../all_cuda-129_arch-x86_64.yaml | 2 + .../all_cuda-131_arch-aarch64.yaml | 2 + .../all_cuda-131_arch-x86_64.yaml | 2 + dependencies.yaml | 7 +- 9 files changed, 184 insertions(+), 3 deletions(-) create mode 100755 ci/build_java.sh create mode 100755 ci/test_java.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7a98079417..60e7857cc9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -183,6 +183,24 @@ jobs: artifact-name: "cuopt_docs" container_image: "rapidsai/ci-conda:26.06-latest" script: "ci/build_docs.sh" + java-build: + # Build cuopt-java JAR for main / release-branch / tag pushes. + # amd64-only initially; arm64 build planned once jextract is in the + # arm64 CI image. + needs: [cpp-build] + secrets: inherit + uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main + with: + build_type: ${{ inputs.build_type || 'branch' }} + node_type: "linux-amd64-cpu16" + sha: ${{ inputs.sha }} + branch: ${{ inputs.branch }} + date: ${{ inputs.date }} + arch: "amd64" + file_to_upload: "java/cuopt-java/target/" + artifact-name: "cuopt-java" + container_image: "rapidsai/ci-conda:26.06-latest" + script: "ci/build_java.sh" wheel-build-cuopt-sh-client: secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 4a1f29319b..8a2292c61c 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -22,6 +22,7 @@ jobs: - checks - conda-cpp-build - conda-cpp-tests + - conda-java-build-and-tests - conda-python-build - conda-python-tests - docs-build @@ -354,6 +355,21 @@ jobs: - '!sonarqube/**' - '!ucf/**' - '!utilities/**' + test_java: + # Path-positive list — easier to reason about than the inverse + # pattern used for test_cpp / test_python. + - 'java/**' + - 'ci/build_java.sh' + - 'ci/test_java.sh' + - 'dependencies.yaml' + - 'conda/environments/**' + # Java bindings are jextract-generated from these C headers, + # so any C API change should re-trigger Java tests. + - 'cpp/include/cuopt/linear_programming/cuopt_c.h' + - 'cpp/include/cuopt/linear_programming/constants.h' + # Workflow files themselves + - '.github/workflows/pr.yaml' + - '.github/workflows/build.yaml' checks: secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@main @@ -387,6 +403,32 @@ jobs: script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }} script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} + conda-java-build-and-tests-matrix: + # Derives the matrix from conda-cpp-build, filtered to amd64 (matches + # cuvs pattern). arm64 build support is planned but blocked on jextract + # availability in the arm64 CI image. + needs: [conda-cpp-build, changed-files] + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java + uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main + with: + build_type: pull-request + matrix_name: conda-cpp-build + matrix_filter: 'map(select(.ARCH == "amd64"))' + conda-java-build-and-tests: + # Combined build+test in one job (matches cuvs pattern). Splitting + # this is a follow-up: requires shared-workflow surface for cross-job + # artifact passing. cuvs Issue #868 tracks the same split. + needs: conda-java-build-and-tests-matrix + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java + secrets: inherit + uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main + with: + build_type: pull-request + node_type: "gpu-l4-latest-1" + arch: "amd64" + script: "ci/test_java.sh" + file_to_upload: "java/cuopt-java/target/" + artifact-name: "cuopt-java-cuda${{ needs.conda-java-build-and-tests-matrix.outputs.CUDA_VER }}" conda-python-build: needs: [conda-cpp-build, compute-matrix-filters, changed-files] # Consumed by conda-python-tests and docs-build. diff --git a/ci/build_java.sh b/ci/build_java.sh new file mode 100755 index 0000000000..e9f0cfefb2 --- /dev/null +++ b/ci/build_java.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Build cuopt-java in CI. +# +# Usage: +# ci/build_java.sh # build only, skip tests +# ci/build_java.sh --run-java-tests # build + tests +# +# Inputs (set by RAPIDS shared workflow): +# RAPIDS_CUDA_VERSION +# +# Outputs: +# java/cuopt-java/target/cuopt-java-*.jar (uploaded by the calling +# workflow via artifact-name) + +set -euo pipefail + +EXITCODE=0 +trap "EXITCODE=1" ERR +set +e + +# Argument handling — match cuvs build_java.sh contract +RUN_JAVA_TESTS="false" +if [[ "${1:-}" == "--run-java-tests" ]]; then + RUN_JAVA_TESTS="true" +fi + +source rapids-configure-sccache + +. /opt/conda/etc/profile.d/conda.sh + +rapids-logger "Configuring conda strict channel priority" +conda config --set channel_priority strict + +# Pull libcuopt conda package built by upstream conda-cpp-build job. +# libcuopt.so + cuopt_c.h + constants.h end up in $CPP_CHANNEL. +CPP_CHANNEL=$(rapids-download-conda-from-github cpp) + +rapids-logger "Generate Java conda environment" +rapids-dependency-file-generator \ + --output conda \ + --file-key test_java \ + --matrix "cuda=${RAPIDS_CUDA_VERSION%%.*};arch=$(arch)" \ + --prepend-channel "${CPP_CHANNEL}" \ + | tee env.yaml + +rapids-mamba-retry env create --yes -f env.yaml -n java + +set +u +conda activate java +set -u + +rapids-logger "Build cuopt-java (run_tests=${RUN_JAVA_TESTS})" + +# Point the Java build at the conda prefix where libcuopt lives. +export CUOPT_INCLUDE="${CONDA_PREFIX}/include" +export CMAKE_PREFIX_PATH="${CONDA_PREFIX}/lib" + +# jextract is not on conda-forge. The CI image must provide it. +# TODO: build out a CI image with jextract preinstalled (follow-up PR). +if ! command -v jextract >/dev/null 2>&1; then + rapids-logger "ERROR: jextract not available in CI image." + rapids-logger " Add jextract for JDK 22 to the CI image." + exit 1 +fi + +# SKIP_DRIFT_CHECK=true on first build (before panama bindings are committed). +# Remove this once the panama/ files exist in the repo. +if [[ "${RUN_JAVA_TESTS}" == "true" ]]; then + SKIP_DRIFT_CHECK=true ./java/build.sh +else + SKIP_DRIFT_CHECK=true SKIP_TESTS=true ./java/build.sh +fi + +rapids-logger "Show sccache stats" +sccache --show-adv-stats || true + +rapids-logger "Build script exiting with value: $EXITCODE" +exit ${EXITCODE} diff --git a/ci/test_java.sh b/ci/test_java.sh new file mode 100755 index 0000000000..6c6874fb95 --- /dev/null +++ b/ci/test_java.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Run cuopt-java tests in CI. +# +# Currently a thin wrapper that delegates to ci/build_java.sh with the +# --run-java-tests flag (matches cuvs's pattern). The build/test split +# tracked in cuvs Issue #868 is a deferred follow-up — switching to +# pre-built artifact consumption requires shared-workflow surface area +# for cross-job artifact download that doesn't exist yet. + +set -euo pipefail + +EXITCODE=0 +trap "EXITCODE=1" ERR +set +e + +rapids-logger "Check GPU usage" +nvidia-smi + +rapids-logger "Run Java build and tests" + +# TODO(java-build-test-split): switch to consuming a prebuilt JAR from +# conda-java-build job. Requires custom-job.yaml to expose artifact +# download or use of actions/download-artifact in this script. +# Ref: cuvs Issue rapidsai/cuvs#868 +ci/build_java.sh --run-java-tests + +rapids-logger "Test script exiting with value: $EXITCODE" +exit ${EXITCODE} diff --git a/conda/environments/all_cuda-129_arch-aarch64.yaml b/conda/environments/all_cuda-129_arch-aarch64.yaml index d09e44d96d..0b33f90b9b 100644 --- a/conda/environments/all_cuda-129_arch-aarch64.yaml +++ b/conda/environments/all_cuda-129_arch-aarch64.yaml @@ -39,6 +39,7 @@ dependencies: - libraft-headers==26.6.*,>=0.0.0a0 - librmm==26.6.*,>=0.0.0a0 - make +- maven>=3.9.6 - msgpack-numpy==0.4.8 - msgpack-python==1.1.2 - myst-parser @@ -48,6 +49,7 @@ dependencies: - numba>=0.60.0,<0.65.0 - numpy>=1.23.5,<3.0 - numpydoc +- openjdk=22.* - openssl - pandas>=2.0 - pexpect diff --git a/conda/environments/all_cuda-129_arch-x86_64.yaml b/conda/environments/all_cuda-129_arch-x86_64.yaml index a90314d16c..26bc3d66fd 100644 --- a/conda/environments/all_cuda-129_arch-x86_64.yaml +++ b/conda/environments/all_cuda-129_arch-x86_64.yaml @@ -39,6 +39,7 @@ dependencies: - libraft-headers==26.6.*,>=0.0.0a0 - librmm==26.6.*,>=0.0.0a0 - make +- maven>=3.9.6 - msgpack-numpy==0.4.8 - msgpack-python==1.1.2 - myst-parser @@ -48,6 +49,7 @@ dependencies: - numba>=0.60.0,<0.65.0 - numpy>=1.23.5,<3.0 - numpydoc +- openjdk=22.* - openssl - pandas>=2.0 - pexpect diff --git a/conda/environments/all_cuda-131_arch-aarch64.yaml b/conda/environments/all_cuda-131_arch-aarch64.yaml index b1acfe1c4c..1f7bd3f01e 100644 --- a/conda/environments/all_cuda-131_arch-aarch64.yaml +++ b/conda/environments/all_cuda-131_arch-aarch64.yaml @@ -39,6 +39,7 @@ dependencies: - libraft-headers==26.6.*,>=0.0.0a0 - librmm==26.6.*,>=0.0.0a0 - make +- maven>=3.9.6 - msgpack-numpy==0.4.8 - msgpack-python==1.1.2 - myst-parser @@ -48,6 +49,7 @@ dependencies: - numba>=0.60.0,<0.65.0 - numpy>=1.23.5,<3.0 - numpydoc +- openjdk=22.* - openssl - pandas>=2.0 - pexpect diff --git a/conda/environments/all_cuda-131_arch-x86_64.yaml b/conda/environments/all_cuda-131_arch-x86_64.yaml index 3d4d03c85c..28fec0fa58 100644 --- a/conda/environments/all_cuda-131_arch-x86_64.yaml +++ b/conda/environments/all_cuda-131_arch-x86_64.yaml @@ -39,6 +39,7 @@ dependencies: - libraft-headers==26.6.*,>=0.0.0a0 - librmm==26.6.*,>=0.0.0a0 - make +- maven>=3.9.6 - msgpack-numpy==0.4.8 - msgpack-python==1.1.2 - myst-parser @@ -48,6 +49,7 @@ dependencies: - numba>=0.60.0,<0.65.0 - numpy>=1.23.5,<3.0 - numpydoc +- openjdk=22.* - openssl - pandas>=2.0 - pexpect diff --git a/dependencies.yaml b/dependencies.yaml index f3a5b2631b..5f9421e961 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -37,6 +37,7 @@ files: - depends_on_rapids_logger - depends_on_rmm - rapids_build_backend + - java test_cpp: output: none includes: @@ -49,7 +50,7 @@ files: output: none includes: - cuda_version - - build_java + - java - depends_on_libcuopt test_python: output: none @@ -319,14 +320,14 @@ dependencies: - output_types: [conda] packages: - cuda-sanitizer-api - build_java: + java: common: - output_types: [conda] packages: # Java 22 is the minimum for FFM final (no preview flag). # Public API compiles to Java 21 release; runtime requires Java 22+. # See java/README.md for the full multi-release-JAR rationale. - - openjdk=22 + - openjdk=22.* - maven>=3.9.6 # jextract is not available on conda-forge; java/build.sh expects # it to be installed manually. See java/README.md. From 8f7770d956c18e0bec63de8436d90c9922db6d21 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Mon, 11 May 2026 11:39:48 -0500 Subject: [PATCH 03/28] java: add LP/MILP/QP public API and FFM implementation Builds out the full public Java API for LP, MILP, and QP on top of the skeleton + CI from the prior commits. Public API surface (Java 21, src/main/java/): - Problem: build problem (addVariable, addConstraint, setObjective), solve(), and post-solve accessors (status, objectiveValue, solveTime, lpStats, milpStats). Owns native handle + all solution arrays. - Variable / Constraint: immutable handles that delegate value() / reducedCost() / dualValue() / slack() back to the owning Problem. - LinearExpr / QuadraticExpr: mutable expression builders supporting both addTerm(coeff, var) (chainable single-term) and addTerms(double[], Variable[]) (bulk). Coefficients accumulate. - SolverSettings: typed setters (setTimeLimit, setOptimalityTolerance, setMethod, setRelativeMipGap, ...) + generic setParameter(name, value) escape hatch for forward compatibility. AutoCloseable. - DataModel: low-level escape hatch matching cuOpt Python's DataModel. CSR setters return this for chaining. - Enums: VType (CONTINUOUS/INTEGER/BINARY), CType (LE/GE/EQ), Sense, SolverMethod, PdlpSolverMode, TerminationStatus, ErrorStatus, ProblemCategory. - Records: LpStats, MilpStats. - CuOpt constants holder: static-importable INF, MINIMIZE, LESS_EQUAL, and parameter-name string constants (TIME_LIMIT, METHOD, etc.). FFM implementation (Java 22, src/main/java22/internal/): - CuOptProviderImpl: marshals Java arrays -> MemorySegment, calls jextract-generated cuopt_c_h methods, extracts solution data into Java arrays before freeing the native handle. - CsrBuilder: translates List constraint expressions into CSR (row-offsets, column-indices, values) sorted by column. - Native handles cross the SPI boundary as long (raw addresses); ProblemImpl reconstructs MemorySegment from the address on each call. Tests: - LpSolverTest: simple LP, diet LP, introspection. - MilpSolverTest: 0-1 knapsack. - QpSolverTest: mirrors cuOpt Python test_qp.py::test_solver. - LinearExprTest: addTerm/addTerms interchangeability, coefficient accumulation, length-mismatch and mixed-problem error paths. This commit completes the full LP/MILP/QP public API. Tests cannot run until: (1) JDK 22 + jextract installed on a workstation, (2) generated panama bindings committed under java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/. See temp/cuopt-java-RESUME.md for the verify-locally checklist. --- .../src/main/java/com/nvidia/cuopt/CuOpt.java | 76 +++ .../main/java/com/nvidia/cuopt/Solver.java | 49 +- .../cuopt/linear_programming/CType.java | 32 ++ .../cuopt/linear_programming/Constraint.java | 163 ++++++ .../cuopt/linear_programming/DataModel.java | 290 ++++++++++ .../cuopt/linear_programming/ErrorStatus.java | 43 ++ .../cuopt/linear_programming/LinearExpr.java | 129 +++++ .../cuopt/linear_programming/LpStats.java | 27 + .../cuopt/linear_programming/MilpStats.java | 25 + .../linear_programming/PdlpSolverMode.java | 38 ++ .../cuopt/linear_programming/Problem.java | 420 +++++++++++++++ .../linear_programming/ProblemCategory.java | 20 + .../linear_programming/QuadraticExpr.java | 139 +++++ .../cuopt/linear_programming/Sense.java | 27 + .../linear_programming/SolverMethod.java | 39 ++ .../linear_programming/SolverSettings.java | 188 +++++++ .../linear_programming/TerminationStatus.java | 45 ++ .../cuopt/linear_programming/VType.java | 30 ++ .../cuopt/linear_programming/Variable.java | 111 ++++ .../com/nvidia/cuopt/spi/CuOptProvider.java | 48 +- .../com/nvidia/cuopt/spi/SolveResult.java | 38 ++ .../com/nvidia/cuopt/internal/CsrBuilder.java | 152 ++++++ .../cuopt/internal/CuOptProviderImpl.java | 508 +++++++++++++++++- .../linear_programming/LinearExprTest.java | 64 +++ .../linear_programming/LpSolverTest.java | 111 ++++ .../linear_programming/MilpSolverTest.java | 63 +++ .../linear_programming/QpSolverTest.java | 56 ++ 27 files changed, 2904 insertions(+), 27 deletions(-) create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOpt.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/CType.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ErrorStatus.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LinearExpr.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LpStats.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MilpStats.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Sense.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverMethod.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/TerminationStatus.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/VType.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java create mode 100644 java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CsrBuilder.java create mode 100644 java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java create mode 100644 java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverTest.java create mode 100644 java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverTest.java create mode 100644 java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverTest.java diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOpt.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOpt.java new file mode 100644 index 0000000000..4b1c455b8f --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOpt.java @@ -0,0 +1,76 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt; + +import com.nvidia.cuopt.linear_programming.CType; +import com.nvidia.cuopt.linear_programming.Sense; +import com.nvidia.cuopt.linear_programming.VType; + +/** + * Constants holder for cuopt-java. Designed for static import: + * + *

{@code
+ *     import static com.nvidia.cuopt.CuOpt.*;
+ *
+ *     Variable x = problem.addVariable(0, INF, CONTINUOUS, "x");
+ *     problem.addConstraint(expr, LESS_EQUAL, 100, "c1");
+ *     problem.setObjective(obj, MAXIMIZE);
+ * }
+ * + *

Parameter name string constants (mirrors of the C-side + * {@code CUOPT_*} preprocessor macros from {@code constants.h}) are + * grouped at the bottom. They're used with + * {@link com.nvidia.cuopt.linear_programming.SolverSettings#setParameter(String, Object)}. + */ +public final class CuOpt { + + private CuOpt() {} + + // ── numeric constants ──────────────────────────────────────── + /** Positive infinity, for unbounded variable / constraint sides. */ + public static final double INF = Double.POSITIVE_INFINITY; + /** Negative infinity. */ + public static final double NEG_INF = Double.NEGATIVE_INFINITY; + + // ── enum re-exports (static-importable shortcuts) ──────────── + public static final VType CONTINUOUS = VType.CONTINUOUS; + public static final VType INTEGER = VType.INTEGER; + public static final VType BINARY = VType.BINARY; + + public static final CType LESS_EQUAL = CType.LE; + public static final CType GREATER_EQUAL = CType.GE; + public static final CType EQUAL = CType.EQ; + + public static final Sense MINIMIZE = Sense.MINIMIZE; + public static final Sense MAXIMIZE = Sense.MAXIMIZE; + + // ── solver parameter name strings (subset; the rest are + // available via setParameter(name, value) with raw strings) ─ + public static final String TIME_LIMIT = "time_limit"; + public static final String ITERATION_LIMIT = "iteration_limit"; + public static final String WORK_LIMIT = "work_limit"; + public static final String METHOD = "method"; + public static final String PDLP_SOLVER_MODE = "pdlp_solver_mode"; + + public static final String ABSOLUTE_PRIMAL_TOLERANCE = "absolute_primal_tolerance"; + public static final String RELATIVE_PRIMAL_TOLERANCE = "relative_primal_tolerance"; + public static final String ABSOLUTE_DUAL_TOLERANCE = "absolute_dual_tolerance"; + public static final String RELATIVE_DUAL_TOLERANCE = "relative_dual_tolerance"; + public static final String ABSOLUTE_GAP_TOLERANCE = "absolute_gap_tolerance"; + public static final String RELATIVE_GAP_TOLERANCE = "relative_gap_tolerance"; + + public static final String MIP_ABSOLUTE_GAP = "mip_absolute_gap"; + public static final String MIP_RELATIVE_GAP = "mip_relative_gap"; + public static final String MIP_INTEGRALITY_TOLERANCE = "mip_integrality_tolerance"; + + public static final String LOG_TO_CONSOLE = "log_to_console"; + public static final String LOG_FILE = "log_file"; + public static final String NUM_CPU_THREADS = "num_cpu_threads"; + public static final String NUM_GPUS = "num_gpus"; + public static final String RANDOM_SEED = "random_seed"; + public static final String CROSSOVER = "crossover"; + public static final String PRESOLVE = "presolve"; + public static final String INFEASIBILITY_DETECTION = "infeasibility_detection"; +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java index 2da4545fc8..1e6328d61b 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java @@ -4,15 +4,20 @@ */ package com.nvidia.cuopt; +import com.nvidia.cuopt.linear_programming.DataModel; +import com.nvidia.cuopt.linear_programming.Problem; +import com.nvidia.cuopt.linear_programming.SolverSettings; import com.nvidia.cuopt.spi.CuOptProvider; +import java.lang.reflect.Method; /** - * Entry point for cuopt-java. + * Static utility entry points for cuopt-java. * - *

This class currently exposes only {@link #getVersion()} as a - * minimal end-to-end demonstration of the FFM bridge. The full LP / - * MILP / QP API ({@code Problem}, {@code Variable}, {@code LinearExpr}, - * etc.) lands in subsequent PRs. + *

Most users call {@link Problem#solve()} or + * {@link Problem#solve(SolverSettings)} on a Problem directly. The + * static {@code Solver.solve(...)} overloads here are convenience + * wrappers that match cuOpt Python's {@code Solver.Solve(dm, settings)} + * call shape. */ public final class Solver { @@ -20,13 +25,39 @@ private Solver() {} /** * Returns the cuOpt library version (from {@code libcuopt.so}) as a - * human-readable string. + * human-readable {@code major.minor.patch} string. * - * @throws CuOptException if the native library cannot be loaded or - * the FFM implementation is missing (e.g., - * running on Java 21). + * @throws CuOptException if the native library cannot be loaded. */ public static String getVersion() { return CuOptProvider.instance().getVersion(); } + + // ── solve overloads ────────────────────────────────────────── + + public static void solve(Problem problem) { + problem.solve(); + } + + public static void solve(Problem problem, SolverSettings settings) { + problem.solve(settings); + } + + public static void solve(DataModel dm) { + solve(dm, null); + } + + public static void solve(DataModel dm, SolverSettings settings) { + // Package-private call on DataModel — Solver lives in com.nvidia.cuopt, + // DataModel lives in com.nvidia.cuopt.linear_programming, so we go + // through reflection to access solveInternal. Replace with a public + // SPI entry point or move Solver into the same package later. + try { + Method m = DataModel.class.getDeclaredMethod("solveInternal", SolverSettings.class); + m.setAccessible(true); + m.invoke(dm, settings); + } catch (ReflectiveOperationException e) { + throw new CuOptException("Internal: failed to dispatch DataModel.solveInternal", e); + } + } } diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/CType.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/CType.java new file mode 100644 index 0000000000..c5ff95c3f7 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/CType.java @@ -0,0 +1,32 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Constraint sense for {@code Problem.addConstraint(...)}. + * + *

Maps to the C API constants {@code CUOPT_LESS_THAN} ({@code 'L'}), + * {@code CUOPT_GREATER_THAN} ({@code 'G'}), and {@code CUOPT_EQUAL} + * ({@code 'E'}). + */ +public enum CType { + /** Less than or equal: {@code lhs <= rhs}. */ + LE('L'), + /** Greater than or equal: {@code lhs >= rhs}. */ + GE('G'), + /** Equal: {@code lhs == rhs}. */ + EQ('E'); + + private final char code; + + CType(char code) { + this.code = code; + } + + /** Returns the C-API char encoding. */ + public char code() { + return code; + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java new file mode 100644 index 0000000000..d10b3ba980 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java @@ -0,0 +1,163 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import com.nvidia.cuopt.CuOptException; +import java.util.Objects; + +/** + * A constraint owned by a {@link Problem}. + * + *

Like {@link Variable}, this is an immutable handle. Post-solve + * accessors ({@link #dualValue()}, {@link #slack()}) delegate back to + * the owning Problem. + * + *

Constraints can be one-sided (a single {@code rhs} with a + * {@code sense} in {@link CType}) or ranged (lower <= lhs <= upper); + * {@link #isRanged()} discriminates. + */ +public final class Constraint { + + private final Problem owner; + private final int index; + private final CType sense; // null for ranged constraints + private final double rhs; // single rhs for one-sided + private final double lowerBound; // for ranged + private final double upperBound; // for ranged + private final boolean ranged; + private final String name; + + // Package-private constructor for one-sided constraints. + Constraint(Problem owner, int index, CType sense, double rhs, String name) { + this.owner = Objects.requireNonNull(owner, "owner"); + this.index = index; + this.sense = Objects.requireNonNull(sense, "sense"); + this.rhs = rhs; + this.lowerBound = Double.NaN; + this.upperBound = Double.NaN; + this.ranged = false; + this.name = name == null ? "" : name; + } + + // Package-private constructor for ranged constraints. + Constraint(Problem owner, int index, double lowerBound, double upperBound, String name) { + this.owner = Objects.requireNonNull(owner, "owner"); + this.index = index; + this.sense = null; + this.rhs = Double.NaN; + this.lowerBound = lowerBound; + this.upperBound = upperBound; + this.ranged = true; + this.name = name == null ? "" : name; + } + + public int index() { + return index; + } + + public String name() { + return name; + } + + /** + * Constraint sense ({@link CType#LE}, {@link CType#GE}, + * {@link CType#EQ}) for one-sided constraints. + * + * @throws IllegalStateException if this is a ranged constraint. + */ + public CType sense() { + if (ranged) { + throw new IllegalStateException( + "sense() is not defined for ranged constraints; use lowerBound()/upperBound()"); + } + return sense; + } + + /** + * Right-hand side for one-sided constraints. + * + * @throws IllegalStateException if this is a ranged constraint. + */ + public double rhs() { + if (ranged) { + throw new IllegalStateException( + "rhs() is not defined for ranged constraints; use lowerBound()/upperBound()"); + } + return rhs; + } + + /** Whether this is a ranged constraint (lower <= lhs <= upper). */ + public boolean isRanged() { + return ranged; + } + + /** + * Lower bound for ranged constraints. For one-sided constraints, + * returns the appropriate one-sided bound (e.g. rhs for GE; -infinity for LE). + */ + public double lowerBound() { + if (ranged) return lowerBound; + return switch (sense) { + case LE -> Double.NEGATIVE_INFINITY; + case GE, EQ -> rhs; + }; + } + + /** + * Upper bound for ranged constraints. For one-sided constraints, + * returns the appropriate one-sided bound (e.g. rhs for LE; +infinity for GE). + */ + public double upperBound() { + if (ranged) return upperBound; + return switch (sense) { + case LE, EQ -> rhs; + case GE -> Double.POSITIVE_INFINITY; + }; + } + + // ── post-solve accessors ───────────────────────────────────── + + /** + * Dual value (shadow price) of this constraint in the current + * LP solution. LP only — for MIP solves, returns {@code Double.NaN}. + * + * @throws CuOptException if the owning Problem has not been solved + * or has been closed. + */ + public double dualValue() { + return owner.dualValueOf(index); + } + + /** + * Slack of this constraint in the current solution. + * + * @throws CuOptException if the owning Problem has not been solved + * or has been closed. + */ + public double slack() { + return owner.slackOf(index); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof Constraint other)) return false; + return owner == other.owner && index == other.index; + } + + @Override + public int hashCode() { + return System.identityHashCode(owner) * 31 + index; + } + + @Override + public String toString() { + return name.isEmpty() ? "Constraint[" + index + "]" : "Constraint[" + name + "]"; + } + + Problem owner() { + return owner; + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java new file mode 100644 index 0000000000..127bb3919e --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java @@ -0,0 +1,290 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import com.nvidia.cuopt.CuOptException; +import com.nvidia.cuopt.spi.CuOptProvider; +import com.nvidia.cuopt.spi.SolveResult; +import java.util.Optional; + +/** + * Low-level escape-hatch API matching cuOpt's Python + * {@code data_model.DataModel}. Use this when you already have + * CSR-format constraint matrices (e.g., from MPS parsing or + * programmatic generation) and don't want the {@link Problem} modeling + * layer. + * + *

All setters return {@code this} for chaining. Bulk-array + * arguments are not defensively copied — do not mutate the supplied + * arrays before {@code Solver.solve(dm)} is called. + * + *

{@code
+ *   try (var dm = new DataModel()) {
+ *       dm.setCsrConstraintMatrix(values, indices, offsets)
+ *         .setObjectiveCoefficients(c)
+ *         .setVariableLowerBounds(lb)
+ *         .setVariableUpperBounds(ub)
+ *         .setRowTypes(new CType[]{CType.LE, CType.GE});
+ *
+ *       Solver.solve(dm);
+ *
+ *       System.out.println(dm.status());
+ *       System.out.println(java.util.Arrays.toString(dm.primalSolution()));
+ *   }
+ * }
+ */ +public final class DataModel implements AutoCloseable { + + // ── problem definition ─────────────────────────────────────── + private boolean maximize = false; + private double objectiveOffset = 0.0; + private double[] objectiveCoefficients; + private double[] constraintMatrixValues; + private int[] constraintMatrixIndices; + private int[] constraintMatrixOffsets; + private double[] quadraticObjectiveValues; + private int[] quadraticObjectiveIndices; + private int[] quadraticObjectiveOffsets; + private double[] variableLowerBounds; + private double[] variableUpperBounds; + private double[] constraintLowerBounds; + private double[] constraintUpperBounds; + private double[] constraintBounds; // for one-sided (single rhs) + private CType[] rowTypes; + private VType[] variableTypes; + private String problemName = ""; + private String[] variableNames; + private String[] rowNames; + private String objectiveName = ""; + + // ── post-solve state ───────────────────────────────────────── + private boolean solved = false; + private double[] primalSolution; + private double[] dualSolution; + private double[] reducedCost; + private TerminationStatus status; + private String terminationReason; + private ErrorStatus errorStatus; + private String errorMessage; + private double objectiveValue; + private double dualObjectiveValue; + private double solveTime; + private SolverMethod solvedBy; + private LpStats lpStats; + private MilpStats milpStats; + + private boolean closed = false; + + public DataModel() {} + + // ── builder-style setters (chainable) ──────────────────────── + + public DataModel setMaximize(boolean maximize) { + this.maximize = maximize; + return this; + } + + public DataModel setObjectiveOffset(double offset) { + this.objectiveOffset = offset; + return this; + } + + public DataModel setObjectiveCoefficients(double[] c) { + this.objectiveCoefficients = c; + return this; + } + + public DataModel setCsrConstraintMatrix(double[] values, int[] indices, int[] offsets) { + this.constraintMatrixValues = values; + this.constraintMatrixIndices = indices; + this.constraintMatrixOffsets = offsets; + return this; + } + + public DataModel setQuadraticObjectiveMatrix(double[] values, int[] indices, int[] offsets) { + this.quadraticObjectiveValues = values; + this.quadraticObjectiveIndices = indices; + this.quadraticObjectiveOffsets = offsets; + return this; + } + + public DataModel setVariableLowerBounds(double[] lb) { + this.variableLowerBounds = lb; + return this; + } + + public DataModel setVariableUpperBounds(double[] ub) { + this.variableUpperBounds = ub; + return this; + } + + public DataModel setConstraintLowerBounds(double[] lb) { + this.constraintLowerBounds = lb; + return this; + } + + public DataModel setConstraintUpperBounds(double[] ub) { + this.constraintUpperBounds = ub; + return this; + } + + /** Sets one-sided rhs (use together with {@link #setRowTypes(CType[])}). */ + public DataModel setConstraintBounds(double[] b) { + this.constraintBounds = b; + return this; + } + + public DataModel setRowTypes(CType[] types) { + this.rowTypes = types; + return this; + } + + public DataModel setVariableTypes(VType[] types) { + this.variableTypes = types; + return this; + } + + public DataModel setProblemName(String name) { + this.problemName = name == null ? "" : name; + return this; + } + + public DataModel setVariableNames(String[] names) { + this.variableNames = names; + return this; + } + + public DataModel setRowNames(String[] names) { + this.rowNames = names; + return this; + } + + public DataModel setObjectiveName(String name) { + this.objectiveName = name == null ? "" : name; + return this; + } + + // ── post-solve accessors ───────────────────────────────────── + + public double[] primalSolution() { + checkSolved(); + return primalSolution; + } + + public double[] dualSolution() { + checkSolved(); + return dualSolution; + } + + public double[] reducedCost() { + checkSolved(); + return reducedCost; + } + + public TerminationStatus status() { + checkSolved(); + return status; + } + + public String terminationReason() { + checkSolved(); + return terminationReason; + } + + public ErrorStatus errorStatus() { + checkSolved(); + return errorStatus; + } + + public Optional errorMessage() { + checkSolved(); + return Optional.ofNullable(errorMessage); + } + + public double objectiveValue() { + checkSolved(); + return objectiveValue; + } + + public double dualObjectiveValue() { + checkSolved(); + return dualObjectiveValue; + } + + public double solveTime() { + checkSolved(); + return solveTime; + } + + public SolverMethod solvedBy() { + checkSolved(); + return solvedBy; + } + + public LpStats lpStats() { + checkSolved(); + return lpStats; + } + + public Optional milpStats() { + checkSolved(); + return Optional.ofNullable(milpStats); + } + + public boolean isSolved() { + return solved; + } + + // ── solve entry point (used by Solver.solve(dm)) ───────────── + + void solveInternal(SolverSettings settings) { + if (closed) throw new CuOptException("DataModel has been closed"); + SolveResult r = CuOptProvider.instance().solveDataModel(this, settings); + this.primalSolution = r.primalSolution(); + this.dualSolution = r.dualSolution(); + this.reducedCost = r.reducedCost(); + this.status = r.terminationStatus(); + this.terminationReason = r.terminationReason(); + this.errorStatus = r.errorStatus(); + this.errorMessage = r.errorMessage(); + this.objectiveValue = r.objectiveValue(); + this.dualObjectiveValue = r.dualObjectiveValue(); + this.solveTime = r.solveTime(); + this.solvedBy = r.solvedBy(); + this.lpStats = r.lpStats(); + this.milpStats = r.milpStats(); + this.solved = true; + } + + // ── package-private accessors used by ProblemImpl ──────────── + + boolean maximize() { return maximize; } + double objectiveOffset() { return objectiveOffset; } + double[] objectiveCoefficients() { return objectiveCoefficients; } + double[] constraintMatrixValues() { return constraintMatrixValues; } + int[] constraintMatrixIndices() { return constraintMatrixIndices; } + int[] constraintMatrixOffsets() { return constraintMatrixOffsets; } + double[] quadraticObjectiveValues() { return quadraticObjectiveValues; } + int[] quadraticObjectiveIndices() { return quadraticObjectiveIndices; } + int[] quadraticObjectiveOffsets() { return quadraticObjectiveOffsets; } + double[] variableLowerBounds() { return variableLowerBounds; } + double[] variableUpperBounds() { return variableUpperBounds; } + double[] constraintLowerBounds() { return constraintLowerBounds; } + double[] constraintUpperBounds() { return constraintUpperBounds; } + double[] constraintBoundsArray() { return constraintBounds; } + CType[] rowTypes() { return rowTypes; } + VType[] variableTypes() { return variableTypes; } + String problemName() { return problemName; } + + @Override + public void close() { + closed = true; + } + + private void checkSolved() { + if (closed) throw new CuOptException("DataModel has been closed"); + if (!solved) throw new CuOptException("DataModel has not been solved"); + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ErrorStatus.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ErrorStatus.java new file mode 100644 index 0000000000..1d209943bb --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ErrorStatus.java @@ -0,0 +1,43 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Solver error status, distinct from {@link TerminationStatus}. + * {@code SUCCESS} indicates the solver ran without errors (regardless of + * whether it found an optimal solution). + * + *

Maps to the C API status codes (return values from cuOpt functions). + */ +public enum ErrorStatus { + SUCCESS(0), + INVALID_ARGUMENT(1), + MPS_FILE_ERROR(2), + MPS_PARSE_ERROR(3), + VALIDATION_ERROR(4), + OUT_OF_MEMORY(5), + RUNTIME_ERROR(6); + + private final int code; + + ErrorStatus(int code) { + this.code = code; + } + + public int code() { + return code; + } + + public static ErrorStatus fromCode(int code) { + for (ErrorStatus s : values()) { + if (s.code == code) { + return s; + } + } + // Unknown code — fall back to RUNTIME_ERROR rather than throwing, + // since this is on the error-reporting path. + return RUNTIME_ERROR; + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LinearExpr.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LinearExpr.java new file mode 100644 index 0000000000..eb9159ecbe --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LinearExpr.java @@ -0,0 +1,129 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; + +/** + * A mutable linear expression of the form {@code Σ cᵢ·xᵢ + constant}. + * + *

Supports two construction styles, both chainable, freely + * interchangeable. Same-variable coefficients accumulate (Gurobi + * convention): + * + *

{@code
+ *   // Hand-written, per-term:
+ *   LinearExpr e = new LinearExpr()
+ *       .addTerm(2.0, x)
+ *       .addTerm(3.0, y);
+ *
+ *   // Bulk arrays (good for data-driven generation):
+ *   LinearExpr e = new LinearExpr().addTerms(coeffs, vars);
+ *
+ *   // Mix and match:
+ *   LinearExpr e = new LinearExpr()
+ *       .addTerms(baseCoeffs, baseVars)
+ *       .addTerm(0.5, special)
+ *       .addConstant(10);
+ * }
+ * + *

All terms in one expression must reference Variables owned by the + * same {@link Problem}. Mixing across problems throws + * {@link IllegalArgumentException}. + */ +public final class LinearExpr { + + // LinkedHashMap preserves insertion order (useful for deterministic + // CSR builds), keys are Variables, values are summed coefficients. + private final Map terms = new LinkedHashMap<>(); + private double constant = 0.0; + private Problem owner; // null until first term is added + + public LinearExpr() {} + + /** + * Adds a single term {@code coeff · var} to this expression. + * Returns this for chaining. If {@code var} is already present, the + * coefficients sum. + */ + public LinearExpr addTerm(double coeff, Variable var) { + Objects.requireNonNull(var, "var"); + bindOwner(var); + terms.merge(var, coeff, Double::sum); + return this; + } + + /** + * Adds n terms in bulk. {@code coeffs} and {@code vars} must have + * the same length. Same-variable coefficients accumulate. + */ + public LinearExpr addTerms(double[] coeffs, Variable[] vars) { + Objects.requireNonNull(coeffs, "coeffs"); + Objects.requireNonNull(vars, "vars"); + if (coeffs.length != vars.length) { + throw new IllegalArgumentException( + "coefficient array length " + coeffs.length + + " != variable array length " + vars.length); + } + for (int i = 0; i < coeffs.length; i++) { + addTerm(coeffs[i], vars[i]); + } + return this; + } + + /** Adds a scalar offset to the expression. Returns this for chaining. */ + public LinearExpr addConstant(double c) { + this.constant += c; + return this; + } + + /** Adds another linear expression to this one. Returns this. */ + public LinearExpr add(LinearExpr other) { + Objects.requireNonNull(other, "other"); + for (Map.Entry e : other.terms.entrySet()) { + addTerm(e.getValue(), e.getKey()); + } + this.constant += other.constant; + return this; + } + + /** Number of distinct variables in this expression. */ + public int numTerms() { + return terms.size(); + } + + /** Constant offset. */ + public double constant() { + return constant; + } + + /** + * Read-only view of the terms map. Order is insertion order + * (deterministic). Same-variable coefficients have already been + * summed at construction time. + */ + public Map terms() { + return java.util.Collections.unmodifiableMap(terms); + } + + /** + * Owning Problem (the Problem all variables in this expression + * belong to). {@code null} if no terms have been added. + */ + public Problem owner() { + return owner; + } + + private void bindOwner(Variable v) { + if (owner == null) { + owner = v.owner(); + } else if (owner != v.owner()) { + throw new IllegalArgumentException( + "Cannot mix variables from different Problems in one LinearExpr"); + } + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LpStats.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LpStats.java new file mode 100644 index 0000000000..41b1a5e509 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LpStats.java @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Solver statistics for LP solves. Returned by {@code Problem.lpStats()}. + * + *

Fields not measured by the underlying solver are reported as + * {@code Double.NaN} (doubles) or {@code -1L} (longs). + * + * @param primalResidual primal infeasibility residual at termination + * @param dualResidual dual infeasibility residual at termination + * @param primalObjective primal objective value + * @param dualObjective dual objective value + * @param iterations total iteration count + * @param gap relative primal-dual gap at termination + */ +public record LpStats( + double primalResidual, + double dualResidual, + double primalObjective, + double dualObjective, + long iterations, + double gap +) {} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MilpStats.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MilpStats.java new file mode 100644 index 0000000000..1ad7c4ff20 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MilpStats.java @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Solver statistics for MILP solves. Returned by + * {@code Problem.milpStats()} (empty {@link java.util.Optional} for LP-only problems). + * + * @param mipGap relative MIP gap at termination ({@code (UB - LB) / |UB|}) + * @param bestBound best dual bound found + * @param nodesExplored number of branch-and-bound nodes explored + * @param incumbentsFound number of distinct incumbent solutions found + * @param presolveTime wall-clock time spent in presolve, seconds + * @param rootRelaxationTime wall-clock time spent on the root LP relaxation, seconds + */ +public record MilpStats( + double mipGap, + double bestBound, + long nodesExplored, + long incumbentsFound, + double presolveTime, + double rootRelaxationTime +) {} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java new file mode 100644 index 0000000000..df3d9393fc --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * PDLP-specific solver mode tuning. Set via + * {@code SolverSettings.setParameter(CuOpt.PDLP_SOLVER_MODE, mode)}. + * + *

Maps to the C API constants {@code CUOPT_PDLP_SOLVER_MODE_*}. + */ +public enum PdlpSolverMode { + STABLE1(0), + STABLE2(1), + METHODICAL1(2), + FAST1(3), + STABLE3(4); + + private final int code; + + PdlpSolverMode(int code) { + this.code = code; + } + + public int code() { + return code; + } + + public static PdlpSolverMode fromCode(int code) { + for (PdlpSolverMode m : values()) { + if (m.code == code) { + return m; + } + } + throw new IllegalArgumentException("Unknown PdlpSolverMode code: " + code); + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java new file mode 100644 index 0000000000..e42b6a4002 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java @@ -0,0 +1,420 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import com.nvidia.cuopt.CuOptException; +import com.nvidia.cuopt.spi.CuOptProvider; +import com.nvidia.cuopt.spi.SolveResult; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + * An LP / MILP / QP optimization problem. + * + *

{@code Problem} owns all post-solve state. Variables and + * Constraints are lightweight handles that delegate back to the + * Problem for value queries. There is no separate {@code Solution} + * class — primal values are accessed via {@link Variable#value()}, + * duals via {@link Constraint#dualValue()}, and solver-level info + * (status, objective, stats) via accessors on this class. + * + *

{@code
+ *   import static com.nvidia.cuopt.CuOpt.*;
+ *
+ *   try (var problem = new Problem("diet")) {
+ *       Variable x = problem.addVariable(0, INF, CONTINUOUS, "x");
+ *       Variable y = problem.addVariable(0, INF, CONTINUOUS, "y");
+ *
+ *       LinearExpr expr = new LinearExpr().addTerm(2, x).addTerm(3, y);
+ *       problem.addConstraint(expr, LESS_EQUAL, 100, "c1");
+ *
+ *       LinearExpr obj = new LinearExpr().addTerm(1, x).addTerm(1, y);
+ *       problem.setObjective(obj, MAXIMIZE);
+ *
+ *       problem.solve();
+ *
+ *       if (problem.status() == TerminationStatus.OPTIMAL) {
+ *           System.out.println("Optimal: " + problem.objectiveValue());
+ *           System.out.println("x = " + x.value());
+ *           System.out.println("y = " + y.value());
+ *       }
+ *   }
+ * }
+ */ +public final class Problem implements AutoCloseable { + + // ── build-time state ───────────────────────────────────────── + private final String name; + private final List variables = new ArrayList<>(); + private final List constraints = new ArrayList<>(); + private final List constraintExpressions = new ArrayList<>(); + private final Map variablesByName = new HashMap<>(); + private final Map constraintsByName = new HashMap<>(); + + private LinearExpr linearObjective; + private QuadraticExpr quadraticObjective; + private Sense objectiveSense = Sense.MINIMIZE; + private double objectiveOffset = 0.0; + + // ── post-solve state (populated by solve()) ────────────────── + private boolean solved = false; + private double[] primalSolution; + private double[] dualSolution; + private double[] reducedCost; + private double[] slack; + private TerminationStatus status; + private String terminationReason; + private ErrorStatus errorStatus; + private String errorMessage; + private double objectiveValue; + private double dualObjectiveValue; + private double solveTime; + private SolverMethod solvedBy; + private LpStats lpStats; + private MilpStats milpStats; + + private boolean closed = false; + + public Problem() { + this(""); + } + + public Problem(String name) { + this.name = name == null ? "" : name; + } + + public String name() { + return name; + } + + // ── building the problem ───────────────────────────────────── + + public Variable addVariable(double lb, double ub, VType vtype, String name) { + checkNotSolved(); + int index = variables.size(); + Variable v = new Variable(this, index, lb, ub, Objects.requireNonNull(vtype), name); + variables.add(v); + if (name != null && !name.isEmpty()) { + variablesByName.put(name, v); + } + return v; + } + + public Variable addVariable(double lb, double ub, VType vtype) { + return addVariable(lb, ub, vtype, ""); + } + + public Variable addVariable(double lb, double ub) { + return addVariable(lb, ub, VType.CONTINUOUS, ""); + } + + /** Adds a continuous variable with bounds {@code [0, +inf)}. */ + public Variable addVariable() { + return addVariable(0.0, Double.POSITIVE_INFINITY, VType.CONTINUOUS, ""); + } + + public Constraint addConstraint(LinearExpr lhs, CType sense, double rhs, String name) { + checkNotSolved(); + Objects.requireNonNull(lhs, "lhs"); + Objects.requireNonNull(sense, "sense"); + if (lhs.owner() != null && lhs.owner() != this) { + throw new IllegalArgumentException("LinearExpr uses variables from a different Problem"); + } + int index = constraints.size(); + // The constraint constant becomes part of the RHS: lhs + c <= rhs ≡ lhs <= rhs - c + double adjustedRhs = rhs - lhs.constant(); + Constraint c = new Constraint(this, index, sense, adjustedRhs, name); + constraints.add(c); + constraintExpressions.add(snapshotLinear(lhs)); + if (name != null && !name.isEmpty()) { + constraintsByName.put(name, c); + } + return c; + } + + public Constraint addConstraint(LinearExpr lhs, CType sense, double rhs) { + return addConstraint(lhs, sense, rhs, ""); + } + + public Constraint addConstraint(LinearExpr lhs, CType sense, Variable rhsVar, String name) { + // lhs rhsVar ≡ (lhs - rhsVar) 0 + LinearExpr combined = snapshotLinear(lhs); + combined.addTerm(-1.0, rhsVar); + return addConstraint(combined, sense, 0.0, name); + } + + public Constraint addConstraint(LinearExpr lhs, CType sense, LinearExpr rhs, String name) { + // lhs rhs ≡ (lhs - rhs) 0 + LinearExpr combined = snapshotLinear(lhs); + for (Map.Entry e : rhs.terms().entrySet()) { + combined.addTerm(-e.getValue(), e.getKey()); + } + combined.addConstant(-rhs.constant()); + return addConstraint(combined, sense, 0.0, name); + } + + public void setObjective(LinearExpr expr, Sense sense) { + checkNotSolved(); + Objects.requireNonNull(expr, "expr"); + Objects.requireNonNull(sense, "sense"); + if (expr.owner() != null && expr.owner() != this) { + throw new IllegalArgumentException("LinearExpr uses variables from a different Problem"); + } + this.linearObjective = snapshotLinear(expr); + this.quadraticObjective = null; + this.objectiveSense = sense; + this.objectiveOffset = expr.constant(); + } + + public void setObjective(QuadraticExpr expr, Sense sense) { + checkNotSolved(); + Objects.requireNonNull(expr, "expr"); + Objects.requireNonNull(sense, "sense"); + if (expr.owner() != null && expr.owner() != this) { + throw new IllegalArgumentException("QuadraticExpr uses variables from a different Problem"); + } + this.quadraticObjective = expr; + this.linearObjective = null; + this.objectiveSense = sense; + this.objectiveOffset = expr.linearPart().constant(); + } + + // ── introspection ──────────────────────────────────────────── + + public List getVariables() { + return java.util.Collections.unmodifiableList(variables); + } + + public List getConstraints() { + return java.util.Collections.unmodifiableList(constraints); + } + + public Variable getVariable(int index) { + return variables.get(index); + } + + public Variable getVariable(String name) { + return variablesByName.get(name); + } + + public Constraint getConstraint(int index) { + return constraints.get(index); + } + + public Constraint getConstraint(String name) { + return constraintsByName.get(name); + } + + public int numVariables() { + return variables.size(); + } + + public int numConstraints() { + return constraints.size(); + } + + public int numNonZeros() { + int n = 0; + for (LinearExpr e : constraintExpressions) n += e.numTerms(); + return n; + } + + public boolean isMip() { + for (Variable v : variables) { + if (v.variableType() != VType.CONTINUOUS) return true; + } + return false; + } + + public boolean isQp() { + return quadraticObjective != null && quadraticObjective.numQuadraticTerms() > 0; + } + + // ── solve ──────────────────────────────────────────────────── + + public void solve() { + solve(null); + } + + public void solve(SolverSettings settings) { + checkOpen(); + SolveResult result = CuOptProvider.instance().solveProblem(this, settings); + populateFromResult(result); + this.solved = true; + } + + // ── post-solve accessors ───────────────────────────────────── + + public TerminationStatus status() { + checkSolved(); + return status; + } + + public String terminationReason() { + checkSolved(); + return terminationReason; + } + + public ErrorStatus errorStatus() { + checkSolved(); + return errorStatus; + } + + public Optional errorMessage() { + checkSolved(); + return Optional.ofNullable(errorMessage); + } + + public double objectiveValue() { + checkSolved(); + return objectiveValue; + } + + public double dualObjectiveValue() { + checkSolved(); + return dualObjectiveValue; + } + + public double solveTime() { + checkSolved(); + return solveTime; + } + + public SolverMethod solvedBy() { + checkSolved(); + return solvedBy; + } + + public ProblemCategory problemCategory() { + if (isQp()) return ProblemCategory.QP; + if (!isMip()) return ProblemCategory.LP; + // MIP vs IP: IP if all variables are integer + for (Variable v : variables) { + if (v.variableType() == VType.CONTINUOUS) return ProblemCategory.MIP; + } + return ProblemCategory.IP; + } + + public LpStats lpStats() { + checkSolved(); + return lpStats; + } + + public Optional milpStats() { + checkSolved(); + return Optional.ofNullable(milpStats); + } + + public boolean isSolved() { + return solved; + } + + // ── delegation targets used by Variable / Constraint ───────── + + double primalValueOf(int index) { + checkSolved(); + return primalSolution[index]; + } + + double dualValueOf(int index) { + checkSolved(); + if (dualSolution == null) return Double.NaN; + return dualSolution[index]; + } + + double reducedCostOf(int index) { + checkSolved(); + if (reducedCost == null) return Double.NaN; + return reducedCost[index]; + } + + double slackOf(int index) { + checkSolved(); + if (slack == null) return Double.NaN; + return slack[index]; + } + + // ── lifecycle ──────────────────────────────────────────────── + + @Override + public void close() { + if (closed) return; + closed = true; + // Native handles are owned by the SPI implementation (per-instance Arena + // inside ProblemImpl). Closing happens there. + } + + // ── package-private accessors used by ProblemImpl when building + // native problem ──────────────────────────────────────────── + + LinearExpr linearObjective() { + return linearObjective; + } + + QuadraticExpr quadraticObjective() { + return quadraticObjective; + } + + Sense objectiveSense() { + return objectiveSense; + } + + double objectiveOffset() { + return objectiveOffset; + } + + List constraintExpressions() { + return java.util.Collections.unmodifiableList(constraintExpressions); + } + + // ── helpers ────────────────────────────────────────────────── + + private void checkOpen() { + if (closed) throw new CuOptException("Problem has been closed"); + } + + private void checkSolved() { + checkOpen(); + if (!solved) throw new CuOptException("Problem has not been solved"); + } + + private void checkNotSolved() { + checkOpen(); + if (solved) throw new CuOptException("Problem has already been solved; create a new Problem to re-build"); + } + + private void populateFromResult(SolveResult r) { + this.primalSolution = r.primalSolution(); + this.dualSolution = r.dualSolution(); + this.reducedCost = r.reducedCost(); + this.slack = r.slack(); + this.status = r.terminationStatus(); + this.terminationReason = r.terminationReason(); + this.errorStatus = r.errorStatus(); + this.errorMessage = r.errorMessage(); + this.objectiveValue = r.objectiveValue(); + this.dualObjectiveValue = r.dualObjectiveValue(); + this.solveTime = r.solveTime(); + this.solvedBy = r.solvedBy(); + this.lpStats = r.lpStats(); + this.milpStats = r.milpStats(); + } + + // LinearExpr copy used at addConstraint time so the user's + // subsequent mutation of the expression doesn't change the + // constraint we already accepted. + private LinearExpr snapshotLinear(LinearExpr src) { + LinearExpr copy = new LinearExpr(); + for (Map.Entry e : src.terms().entrySet()) { + copy.addTerm(e.getValue(), e.getKey()); + } + copy.addConstant(src.constant()); + return copy; + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java new file mode 100644 index 0000000000..207b66cf48 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Coarse classification of an optimization problem. Returned by + * {@code Problem.problemCategory()}. + */ +public enum ProblemCategory { + /** Linear program: linear objective, linear constraints, all continuous variables. */ + LP, + /** Integer program: linear objective and constraints, all variables integer. */ + IP, + /** Mixed-integer (linear) program: at least one continuous and one integer variable. */ + MIP, + /** Quadratic program: quadratic objective, linear constraints. */ + QP +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java new file mode 100644 index 0000000000..2ec50fcde5 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java @@ -0,0 +1,139 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * A mutable quadratic expression of the form + * {@code Σ qᵢⱼ·xᵢ·xⱼ + Σ cᵢ·xᵢ + constant}. + * + *

The linear part is stored as a {@link LinearExpr}; quadratic terms + * are stored as parallel arrays of (coefficient, var1, var2) triples + * (one entry per Q-matrix non-zero). All chainable methods return + * {@code this}. + * + *

{@code
+ *   QuadraticExpr obj = new QuadraticExpr()
+ *       .addTerms(linearCoeffs, x)              // linear part bulk
+ *       .addQuadraticTerm(1.0, x[0], x[0])      // x[0]² term
+ *       .addQuadraticTerm(0.5, x[0], x[1]);     // 0.5 · x[0]·x[1] term
+ * }
+ */ +public final class QuadraticExpr { + + private final LinearExpr linearPart = new LinearExpr(); + private final List qVar1 = new ArrayList<>(); + private final List qVar2 = new ArrayList<>(); + private final List qCoeff = new ArrayList<>(); + private Problem owner; + + public QuadraticExpr() {} + + /** Adds a linear term {@code coeff · var}. Same convention as {@link LinearExpr#addTerm}. */ + public QuadraticExpr addTerm(double coeff, Variable var) { + bindOwner(Objects.requireNonNull(var, "var")); + linearPart.addTerm(coeff, var); + return this; + } + + /** Adds a bulk linear part. */ + public QuadraticExpr addTerms(double[] coeffs, Variable[] vars) { + Objects.requireNonNull(coeffs, "coeffs"); + Objects.requireNonNull(vars, "vars"); + if (coeffs.length != vars.length) { + throw new IllegalArgumentException( + "coefficient array length " + coeffs.length + + " != variable array length " + vars.length); + } + for (int i = 0; i < vars.length; i++) { + addTerm(coeffs[i], vars[i]); + } + return this; + } + + /** + * Adds a quadratic term {@code coeff · v1 · v2} to the objective. + * For squared terms, pass the same variable twice. + */ + public QuadraticExpr addQuadraticTerm(double coeff, Variable v1, Variable v2) { + Objects.requireNonNull(v1, "v1"); + Objects.requireNonNull(v2, "v2"); + bindOwner(v1); + bindOwner(v2); + qVar1.add(v1); + qVar2.add(v2); + qCoeff.add(coeff); + return this; + } + + /** Adds a scalar offset. */ + public QuadraticExpr addConstant(double c) { + linearPart.addConstant(c); + return this; + } + + /** Adds another quadratic expression. */ + public QuadraticExpr add(QuadraticExpr other) { + Objects.requireNonNull(other, "other"); + linearPart.add(other.linearPart); + for (int i = 0; i < other.qVar1.size(); i++) { + addQuadraticTerm(other.qCoeff.get(i), other.qVar1.get(i), other.qVar2.get(i)); + } + return this; + } + + /** Adds a linear expression to the linear part. */ + public QuadraticExpr add(LinearExpr linear) { + Objects.requireNonNull(linear, "linear"); + if (linear.owner() != null) { + if (owner == null) owner = linear.owner(); + else if (owner != linear.owner()) { + throw new IllegalArgumentException( + "Cannot mix variables from different Problems in one QuadraticExpr"); + } + } + linearPart.add(linear); + return this; + } + + /** Number of quadratic (non-linear) terms. */ + public int numQuadraticTerms() { + return qVar1.size(); + } + + public LinearExpr linearPart() { + return linearPart; + } + + public Problem owner() { + return owner != null ? owner : linearPart.owner(); + } + + // ── package-private accessors for ProblemImpl ──────────────── + + Variable quadVar1(int i) { + return qVar1.get(i); + } + + Variable quadVar2(int i) { + return qVar2.get(i); + } + + double quadCoeff(int i) { + return qCoeff.get(i); + } + + private void bindOwner(Variable v) { + if (owner == null) { + owner = v.owner(); + } else if (owner != v.owner()) { + throw new IllegalArgumentException( + "Cannot mix variables from different Problems in one QuadraticExpr"); + } + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Sense.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Sense.java new file mode 100644 index 0000000000..c6cfbd7aca --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Sense.java @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Objective sense for {@code Problem.setObjective(...)}. + * + *

Maps to the C API constants {@code CUOPT_MINIMIZE} (1) and + * {@code CUOPT_MAXIMIZE} (-1). + */ +public enum Sense { + MINIMIZE(1), + MAXIMIZE(-1); + + private final int code; + + Sense(int code) { + this.code = code; + } + + /** Returns the C-API int encoding (1 for MINIMIZE, -1 for MAXIMIZE). */ + public int code() { + return code; + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverMethod.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverMethod.java new file mode 100644 index 0000000000..f7819f487e --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverMethod.java @@ -0,0 +1,39 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Solver method selection for LP problems. + * + *

Maps to the C API constants {@code CUOPT_METHOD_*}. + */ +public enum SolverMethod { + CONCURRENT(0), + PDLP(1), + DUAL_SIMPLEX(2), + BARRIER(3), + UNSET(4); + + private final int code; + + SolverMethod(int code) { + this.code = code; + } + + /** Returns the C-API int encoding. */ + public int code() { + return code; + } + + /** Inverse of {@link #code()}. Throws {@link IllegalArgumentException} for unknown codes. */ + public static SolverMethod fromCode(int code) { + for (SolverMethod m : values()) { + if (m.code == code) { + return m; + } + } + throw new IllegalArgumentException("Unknown SolverMethod code: " + code); + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java new file mode 100644 index 0000000000..4feb3ab9f5 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java @@ -0,0 +1,188 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import com.nvidia.cuopt.CuOpt; +import com.nvidia.cuopt.CuOptException; +import com.nvidia.cuopt.spi.CuOptProvider; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Solver tuning settings. {@link AutoCloseable} — owns a native + * {@code cuOptSolverSettings} handle. + * + *

Top-frequency parameters have typed setters with IDE autocomplete. + * Anything else falls through to {@link #setParameter(String, Object)} + * for forward compatibility with new C-API parameters. + * + *

{@code
+ *   try (var settings = new SolverSettings()
+ *           .setTimeLimit(60)
+ *           .setOptimalityTolerance(1e-6)
+ *           .setMethod(SolverMethod.PDLP)) {
+ *       // ...
+ *   }
+ * }
+ */ +public final class SolverSettings implements AutoCloseable { + + // We hold parameter values in a Java-side map and replay them onto + // the native handle lazily (just before solve, or eagerly on each + // setParameter call). For now we replay eagerly via the SPI. + private final Map parameters = new LinkedHashMap<>(); + private long nativeHandle; // address of the native cuOptSolverSettings + private boolean closed = false; + + public SolverSettings() { + this.nativeHandle = CuOptProvider.instance().createSolverSettings(); + } + + // ── typed setters (top-frequency parameters) ───────────────── + + public SolverSettings setTimeLimit(double seconds) { + return setFloatParameter(CuOpt.TIME_LIMIT, seconds); + } + + public SolverSettings setIterationLimit(long iterations) { + return setIntegerParameter(CuOpt.ITERATION_LIMIT, iterations); + } + + public SolverSettings setOptimalityTolerance(double eps) { + // Cuopt's "optimality tolerance" is the relative gap tolerance. + return setFloatParameter(CuOpt.RELATIVE_GAP_TOLERANCE, eps); + } + + public SolverSettings setMethod(SolverMethod method) { + return setIntegerParameter(CuOpt.METHOD, method.code()); + } + + public SolverSettings setPdlpSolverMode(PdlpSolverMode mode) { + return setIntegerParameter(CuOpt.PDLP_SOLVER_MODE, mode.code()); + } + + public SolverSettings setRelativeMipGap(double gap) { + return setFloatParameter(CuOpt.MIP_RELATIVE_GAP, gap); + } + + public SolverSettings setAbsoluteMipGap(double gap) { + return setFloatParameter(CuOpt.MIP_ABSOLUTE_GAP, gap); + } + + public SolverSettings setLogToConsole(boolean enabled) { + return setIntegerParameter(CuOpt.LOG_TO_CONSOLE, enabled ? 1 : 0); + } + + public SolverSettings setNumCpuThreads(int n) { + return setIntegerParameter(CuOpt.NUM_CPU_THREADS, n); + } + + public SolverSettings setRandomSeed(long seed) { + return setIntegerParameter(CuOpt.RANDOM_SEED, seed); + } + + // ── generic escape hatch ───────────────────────────────────── + + /** + * Sets a parameter by name. Dispatches to the appropriate typed C-side + * setter based on the value's runtime type: + * + *
    + *
  • {@code Integer}, {@code Long}, {@code Boolean}, or an enum + * with an {@code int code()} method → integer parameter
  • + *
  • {@code Float}, {@code Double} → float parameter
  • + *
  • {@code String} or anything else → string parameter + * (via {@code Object.toString()})
  • + *
+ */ + public SolverSettings setParameter(String name, Object value) { + Objects.requireNonNull(name, "name"); + Objects.requireNonNull(value, "value"); + checkOpen(); + parameters.put(name, value); + + if (value instanceof Boolean b) { + setIntegerParameter(name, b ? 1 : 0); + } else if (value instanceof Integer i) { + setIntegerParameter(name, i.longValue()); + } else if (value instanceof Long l) { + setIntegerParameter(name, l); + } else if (value instanceof Float f) { + setFloatParameter(name, f.doubleValue()); + } else if (value instanceof Double d) { + setFloatParameter(name, d); + } else if (value instanceof SolverMethod sm) { + setIntegerParameter(name, sm.code()); + } else if (value instanceof PdlpSolverMode pm) { + setIntegerParameter(name, pm.code()); + } else if (value instanceof Enum e) { + // Best-effort: try to find a code() method; fallback to ordinal. + try { + java.lang.reflect.Method m = e.getClass().getMethod("code"); + Object code = m.invoke(e); + if (code instanceof Integer ci) { + setIntegerParameter(name, ci.longValue()); + } else if (code instanceof Long cl) { + setIntegerParameter(name, cl); + } else { + setIntegerParameter(name, ((Number) code).longValue()); + } + } catch (ReflectiveOperationException reflectFail) { + setIntegerParameter(name, e.ordinal()); + } + } else { + setStringParameter(name, value.toString()); + } + return this; + } + + public SolverSettings setIntegerParameter(String name, long value) { + checkOpen(); + parameters.put(name, value); + CuOptProvider.instance().setSolverIntegerParameter(nativeHandle, name, value); + return this; + } + + public SolverSettings setFloatParameter(String name, double value) { + checkOpen(); + parameters.put(name, value); + CuOptProvider.instance().setSolverFloatParameter(nativeHandle, name, value); + return this; + } + + public SolverSettings setStringParameter(String name, String value) { + checkOpen(); + parameters.put(name, value); + CuOptProvider.instance().setSolverStringParameter(nativeHandle, name, value); + return this; + } + + /** Returns the last-set value for a parameter, or {@code null} if never set. */ + public Object getParameter(String name) { + return parameters.get(name); + } + + // ── package-private accessors for ProblemImpl ──────────────── + + long nativeHandle() { + checkOpen(); + return nativeHandle; + } + + private void checkOpen() { + if (closed) { + throw new CuOptException("SolverSettings has been closed"); + } + } + + @Override + public synchronized void close() { + if (closed) return; + closed = true; + CuOptProvider.instance().destroySolverSettings(nativeHandle); + nativeHandle = 0L; + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/TerminationStatus.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/TerminationStatus.java new file mode 100644 index 0000000000..d026f12691 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/TerminationStatus.java @@ -0,0 +1,45 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Solver termination status. Returned by {@code Problem.status()} after + * {@code Problem.solve(...)}. + * + *

Maps to the C API constants {@code CUOPT_TERMINATION_STATUS_*}. + */ +public enum TerminationStatus { + NO_TERMINATION(0), + OPTIMAL(1), + INFEASIBLE(2), + UNBOUNDED(3), + ITERATION_LIMIT(4), + TIME_LIMIT(5), + NUMERICAL_ERROR(6), + PRIMAL_FEASIBLE(7), + FEASIBLE_FOUND(8), + CONCURRENT_LIMIT(9), + WORK_LIMIT(10), + UNBOUNDED_OR_INFEASIBLE(11); + + private final int code; + + TerminationStatus(int code) { + this.code = code; + } + + public int code() { + return code; + } + + public static TerminationStatus fromCode(int code) { + for (TerminationStatus s : values()) { + if (s.code == code) { + return s; + } + } + throw new IllegalArgumentException("Unknown TerminationStatus code: " + code); + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/VType.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/VType.java new file mode 100644 index 0000000000..674f96f4b5 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/VType.java @@ -0,0 +1,30 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * Variable type for {@code Problem.addVariable(...)}. + * + *

The C API only distinguishes {@code CONTINUOUS} (char {@code 'C'}) + * and {@code INTEGER} (char {@code 'I'}). {@code BINARY} is exposed as + * a convenience — it's equivalent to {@code INTEGER} with bounds + * {@code [0, 1]}, and is marshalled to the C side as {@code 'I'}. + */ +public enum VType { + CONTINUOUS('C'), + INTEGER('I'), + BINARY('I'); + + private final char code; + + VType(char code) { + this.code = code; + } + + /** Returns the C-API char encoding ({@code 'C'} or {@code 'I'}). */ + public char code() { + return code; + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java new file mode 100644 index 0000000000..34cd805fd3 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java @@ -0,0 +1,111 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import com.nvidia.cuopt.CuOptException; +import java.util.Objects; + +/** + * A decision variable owned by a {@link Problem}. + * + *

{@code Variable} is an immutable handle — all fields are + * {@code final}. Post-solve accessors ({@link #value()}, + * {@link #reducedCost()}) delegate back to the owning Problem rather + * than holding state themselves. + * + *

Variables are equal iff they refer to the same Problem and have + * the same index. + */ +public final class Variable { + + private final Problem owner; + private final int index; + private final double lowerBound; + private final double upperBound; + private final VType variableType; + private final String name; + + // Package-private — only Problem can create Variables. + Variable(Problem owner, int index, double lowerBound, double upperBound, + VType variableType, String name) { + this.owner = Objects.requireNonNull(owner, "owner"); + this.index = index; + this.lowerBound = lowerBound; + this.upperBound = upperBound; + this.variableType = Objects.requireNonNull(variableType, "variableType"); + this.name = name == null ? "" : name; + } + + // ── identity / spec accessors ──────────────────────────────── + + /** Zero-based index of this variable in its owning Problem. */ + public int index() { + return index; + } + + /** Variable name; empty string if none provided. */ + public String name() { + return name; + } + + public double lowerBound() { + return lowerBound; + } + + public double upperBound() { + return upperBound; + } + + public VType variableType() { + return variableType; + } + + // ── post-solve accessors (delegate to owning Problem) ──────── + + /** + * Primal value of this variable in the current solution. + * + * @throws CuOptException if the owning Problem has not been solved + * or has been closed. + */ + public double value() { + return owner.primalValueOf(index); + } + + /** + * Reduced cost of this variable in the current LP solution. LP only; + * returns {@code Double.NaN} for MIP solves. + * + * @throws CuOptException if the owning Problem has not been solved + * or has been closed. + */ + public double reducedCost() { + return owner.reducedCostOf(index); + } + + // ── equality / hashing ─────────────────────────────────────── + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof Variable other)) return false; + return owner == other.owner && index == other.index; + } + + @Override + public int hashCode() { + return System.identityHashCode(owner) * 31 + index; + } + + @Override + public String toString() { + return name.isEmpty() ? "Variable[" + index + "]" : "Variable[" + name + "]"; + } + + // Package-private accessor for owner identity checks in expressions. + Problem owner() { + return owner; + } +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java index d262876e3b..791ad29e69 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java @@ -5,6 +5,9 @@ package com.nvidia.cuopt.spi; import com.nvidia.cuopt.CuOptException; +import com.nvidia.cuopt.linear_programming.DataModel; +import com.nvidia.cuopt.linear_programming.Problem; +import com.nvidia.cuopt.linear_programming.SolverSettings; import java.util.ServiceLoader; /** @@ -13,22 +16,56 @@ * *

This interface compiles to Java 21 release. Method signatures use * only Java 21-compatible types (no {@code MemorySegment}, no - * {@code Arena}). The implementation lives in + * {@code Arena}) — native handles cross the boundary as opaque + * {@code long} values (raw addresses). + * + *

The implementation lives in * {@code com.nvidia.cuopt.internal.CuOptProviderImpl} under * {@code src/main/java22/}; the JVM resolves it via * {@link java.util.ServiceLoader} on Java 22+ runtimes. - * - *

This interface is sealed — third parties cannot provide alternative - * implementations. */ public interface CuOptProvider { + // ── library-level ──────────────────────────────────────────── + /** * Returns the cuOpt library version as a human-readable string in * {@code major.minor.patch} format. */ String getVersion(); + // ── SolverSettings lifecycle (native cuOptSolverSettings) ──── + + /** Creates a native solver-settings handle. Returns the raw pointer as {@code long}. */ + long createSolverSettings(); + + /** Destroys a native solver-settings handle. Idempotent on already-destroyed handles. */ + void destroySolverSettings(long handle); + + void setSolverIntegerParameter(long handle, String name, long value); + void setSolverFloatParameter(long handle, String name, double value); + void setSolverStringParameter(long handle, String name, String value); + + // ── Solve entry points ─────────────────────────────────────── + + /** + * Solves the given Problem with the given settings (or default settings + * if {@code null}). Builds the native problem handle from + * {@code problem}'s collected variables / constraints / objective, + * calls {@code cuOptSolve}, extracts all solution data into a + * {@link SolveResult}, then frees the native solution and problem + * handles before returning. + */ + SolveResult solveProblem(Problem problem, SolverSettings settings); + + /** + * Solves the given DataModel directly (low-level path). Builds the + * native problem handle from the DataModel's CSR arrays. + */ + SolveResult solveDataModel(DataModel dm, SolverSettings settings); + + // ── lookup ─────────────────────────────────────────────────── + /** * Returns the singleton implementation, resolved via * {@link ServiceLoader}. @@ -36,7 +73,8 @@ public interface CuOptProvider { * @throws CuOptException if no implementation is registered * (e.g., running on Java 21 — the FFM * impl lives in the Java 22 multi-release - * layer and is not visible to Java 21 JVMs). + * layer of the JAR and is not visible to + * Java 21 JVMs). */ static CuOptProvider instance() { return Holder.INSTANCE; diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java new file mode 100644 index 0000000000..808dc893c1 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.spi; + +import com.nvidia.cuopt.linear_programming.ErrorStatus; +import com.nvidia.cuopt.linear_programming.LpStats; +import com.nvidia.cuopt.linear_programming.MilpStats; +import com.nvidia.cuopt.linear_programming.SolverMethod; +import com.nvidia.cuopt.linear_programming.TerminationStatus; + +/** + * Internal data carrier from the FFM implementation back to the + * {@link com.nvidia.cuopt.linear_programming.Problem} or + * {@link com.nvidia.cuopt.linear_programming.DataModel} that requested + * the solve. Pre-extracted from the native {@code cuOptSolution} + * handle before that handle is freed. + * + *

This is on the SPI boundary because {@code Problem} (Java 21) + * cannot reference Java 22 FFM types. Pure Java types only. + */ +public record SolveResult( + double[] primalSolution, + double[] dualSolution, + double[] reducedCost, + double[] slack, + TerminationStatus terminationStatus, + String terminationReason, + ErrorStatus errorStatus, + String errorMessage, + double objectiveValue, + double dualObjectiveValue, + double solveTime, + SolverMethod solvedBy, + LpStats lpStats, + MilpStats milpStats +) {} diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CsrBuilder.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CsrBuilder.java new file mode 100644 index 0000000000..9fe2f9f315 --- /dev/null +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CsrBuilder.java @@ -0,0 +1,152 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.internal; + +import com.nvidia.cuopt.linear_programming.LinearExpr; +import com.nvidia.cuopt.linear_programming.QuadraticExpr; +import com.nvidia.cuopt.linear_programming.Variable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Builds CSR (compressed sparse row) representations from + * {@link LinearExpr} / {@link QuadraticExpr} for the FFM bridge. + * + *

Output arrays are ready to copy into native {@code MemorySegment}s. + */ +final class CsrBuilder { + + private CsrBuilder() {} + + /** Output of CSR construction for the linear constraint matrix. */ + static final class Csr { + final int[] rowOffsets; + final int[] colIndices; + final double[] values; + + Csr(int[] rowOffsets, int[] colIndices, double[] values) { + this.rowOffsets = rowOffsets; + this.colIndices = colIndices; + this.values = values; + } + } + + /** + * Builds CSR for the constraint matrix. One row per constraint + * expression, terms sorted by column (variable index) within each + * row. Empty constraints produce a row with no non-zeros. + */ + static Csr buildConstraintCsr(List rows) { + int numRows = rows.size(); + int[] rowOffsets = new int[numRows + 1]; + + // First pass: count non-zeros to size the value/column arrays. + int totalNnz = 0; + for (LinearExpr e : rows) { + totalNnz += e.numTerms(); + } + int[] colIndices = new int[totalNnz]; + double[] values = new double[totalNnz]; + + int writeIdx = 0; + for (int i = 0; i < numRows; i++) { + rowOffsets[i] = writeIdx; + LinearExpr row = rows.get(i); + // Materialize sorted-by-column entries. + List indexBox = new ArrayList<>(row.numTerms()); + List valueBox = new ArrayList<>(row.numTerms()); + for (Map.Entry e : row.terms().entrySet()) { + indexBox.add(new int[]{e.getKey().index()}); + valueBox.add(e.getValue()); + } + // Sort by column index ascending. + Integer[] sortIdx = new Integer[row.numTerms()]; + for (int k = 0; k < sortIdx.length; k++) sortIdx[k] = k; + int[][] indexFinal = indexBox.toArray(new int[0][]); + Double[] valueFinal = valueBox.toArray(new Double[0]); + java.util.Arrays.sort(sortIdx, + (a, b) -> Integer.compare(indexFinal[a][0], indexFinal[b][0])); + + for (int k = 0; k < sortIdx.length; k++) { + colIndices[writeIdx] = indexFinal[sortIdx[k]][0]; + values[writeIdx] = valueFinal[sortIdx[k]]; + writeIdx++; + } + } + rowOffsets[numRows] = writeIdx; + return new Csr(rowOffsets, colIndices, values); + } + + /** + * Builds CSR for the quadratic-objective Q matrix, indexed by + * variable (rows = variables, cols = variables). The user-supplied + * quadratic terms may be upper-triangular or full; we forward them + * as given. cuOpt is expected to accept either form and symmetrize + * internally. + * + *

Returns CSR with {@code numVariables + 1} row offsets. + */ + static Csr buildQuadraticCsr(QuadraticExpr qexpr, int numVariables) { + int n = qexpr.numQuadraticTerms(); + int[] rowOffsets = new int[numVariables + 1]; + + // Bucket entries by row (var1.index()), sort each bucket by col. + List entriesByRow = new ArrayList<>(numVariables); + for (int i = 0; i < numVariables; i++) entriesByRow.add(null); + + // Collect (row, col, val) triples. + int[] rowsRaw = new int[n]; + int[] colsRaw = new int[n]; + double[] valsRaw = new double[n]; + for (int i = 0; i < n; i++) { + rowsRaw[i] = qexpr.quadVar1(i).index(); + colsRaw[i] = qexpr.quadVar2(i).index(); + valsRaw[i] = qexpr.quadCoeff(i); + } + + // Count entries per row. + int[] rowCount = new int[numVariables]; + for (int i = 0; i < n; i++) rowCount[rowsRaw[i]]++; + + rowOffsets[0] = 0; + for (int i = 0; i < numVariables; i++) rowOffsets[i + 1] = rowOffsets[i] + rowCount[i]; + + int[] colIndices = new int[n]; + double[] values = new double[n]; + int[] cursor = new int[numVariables]; + for (int i = 0; i < n; i++) { + int r = rowsRaw[i]; + int pos = rowOffsets[r] + cursor[r]++; + colIndices[pos] = colsRaw[i]; + values[pos] = valsRaw[i]; + } + + // Sort each row by column index. + for (int r = 0; r < numVariables; r++) { + int start = rowOffsets[r]; + int end = rowOffsets[r + 1]; + sortRow(colIndices, values, start, end); + } + return new Csr(rowOffsets, colIndices, values); + } + + private static void sortRow(int[] cols, double[] vals, int start, int end) { + // Simple insertion sort; row sizes in OR matrices are typically small. + for (int i = start + 1; i < end; i++) { + int col = cols[i]; + double val = vals[i]; + int j = i - 1; + while (j >= start && cols[j] > col) { + cols[j + 1] = cols[j]; + vals[j + 1] = vals[j]; + j--; + } + cols[j + 1] = col; + vals[j + 1] = val; + } + } +} diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java index 03fde9e3f3..d88feb0c01 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java @@ -6,29 +6,47 @@ import com.nvidia.cuopt.CuOptException; import com.nvidia.cuopt.internal.panama.cuopt_c_h; +import com.nvidia.cuopt.linear_programming.CType; +import com.nvidia.cuopt.linear_programming.Constraint; +import com.nvidia.cuopt.linear_programming.DataModel; +import com.nvidia.cuopt.linear_programming.ErrorStatus; +import com.nvidia.cuopt.linear_programming.LinearExpr; +import com.nvidia.cuopt.linear_programming.LpStats; +import com.nvidia.cuopt.linear_programming.MilpStats; +import com.nvidia.cuopt.linear_programming.Problem; +import com.nvidia.cuopt.linear_programming.QuadraticExpr; +import com.nvidia.cuopt.linear_programming.SolverMethod; +import com.nvidia.cuopt.linear_programming.SolverSettings; +import com.nvidia.cuopt.linear_programming.TerminationStatus; +import com.nvidia.cuopt.linear_programming.VType; +import com.nvidia.cuopt.linear_programming.Variable; import com.nvidia.cuopt.spi.CuOptProvider; +import com.nvidia.cuopt.spi.SolveResult; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; import java.lang.foreign.ValueLayout; +import java.nio.charset.StandardCharsets; +import java.util.List; /** - * FFM-based implementation of {@link CuOptProvider}. + * FFM implementation of {@link CuOptProvider}. Registered via + * {@code META-INF/services/com.nvidia.cuopt.spi.CuOptProvider}. * - *

Registered via {@code META-INF/services/com.nvidia.cuopt.spi.CuOptProvider}. - * Lives in the Java 22 multi-release layer of the JAR; loaded only on - * JVMs at Java 22 or higher. + *

Lives in the Java 22 multi-release layer; loaded only on JVMs at + * Java 22 or higher. + * + *

Native handles cross the SPI boundary as {@code long} (raw + * addresses); this class reconstructs {@code MemorySegment} from the + * addresses on each call. */ public final class CuOptProviderImpl implements CuOptProvider { - /** - * No-arg constructor required for {@link java.util.ServiceLoader}. - * Eagerly loads the native library so a misconfigured runtime fails - * fast at provider creation rather than on the first call. - */ public CuOptProviderImpl() { NativeLibraryLoader.ensureLoaded(); } + // ── library-level ──────────────────────────────────────────── + @Override public String getVersion() { try (Arena arena = Arena.ofConfined()) { @@ -37,13 +55,477 @@ public String getVersion() { MemorySegment patch = arena.allocate(ValueLayout.JAVA_INT); int rc = cuopt_c_h.cuOptGetVersion(major, minor, patch); - if (rc != 0) { - throw new CuOptException( - "cuOptGetVersion returned non-zero status: " + rc); - } + checkRc(rc, "cuOptGetVersion"); return major.get(ValueLayout.JAVA_INT, 0) + "." + minor.get(ValueLayout.JAVA_INT, 0) + "." + patch.get(ValueLayout.JAVA_INT, 0); } } + + // ── SolverSettings lifecycle ───────────────────────────────── + + @Override + public long createSolverSettings() { + try (Arena local = Arena.ofConfined()) { + MemorySegment outPtr = local.allocate(ValueLayout.ADDRESS); + int rc = cuopt_c_h.cuOptCreateSolverSettings(outPtr); + checkRc(rc, "cuOptCreateSolverSettings"); + return outPtr.get(ValueLayout.ADDRESS, 0).address(); + } + } + + @Override + public void destroySolverSettings(long handle) { + if (handle == 0L) return; + try (Arena local = Arena.ofConfined()) { + MemorySegment ptr = local.allocate(ValueLayout.ADDRESS); + ptr.set(ValueLayout.ADDRESS, 0, MemorySegment.ofAddress(handle)); + cuopt_c_h.cuOptDestroySolverSettings(ptr); + } + } + + @Override + public void setSolverIntegerParameter(long handle, String name, long value) { + try (Arena local = Arena.ofConfined()) { + MemorySegment nameSeg = cString(local, name); + int rc = cuopt_c_h.cuOptSetIntegerParameter( + MemorySegment.ofAddress(handle), nameSeg, (int) value); + checkRc(rc, "cuOptSetIntegerParameter(" + name + ")"); + } + } + + @Override + public void setSolverFloatParameter(long handle, String name, double value) { + try (Arena local = Arena.ofConfined()) { + MemorySegment nameSeg = cString(local, name); + int rc = cuopt_c_h.cuOptSetFloatParameter( + MemorySegment.ofAddress(handle), nameSeg, value); + checkRc(rc, "cuOptSetFloatParameter(" + name + ")"); + } + } + + @Override + public void setSolverStringParameter(long handle, String name, String value) { + try (Arena local = Arena.ofConfined()) { + MemorySegment nameSeg = cString(local, name); + MemorySegment valueSeg = cString(local, value); + int rc = cuopt_c_h.cuOptSetParameter( + MemorySegment.ofAddress(handle), nameSeg, valueSeg); + checkRc(rc, "cuOptSetParameter(" + name + ")"); + } + } + + // ── solve entry points ─────────────────────────────────────── + + @Override + public SolveResult solveProblem(Problem problem, SolverSettings settings) { + try (Arena arena = Arena.ofConfined()) { + ProblemBuild build = buildNativeProblem(arena, problem); + return solveAndExtract(arena, problem, build, settings); + } + } + + @Override + public SolveResult solveDataModel(DataModel dm, SolverSettings settings) { + try (Arena arena = Arena.ofConfined()) { + ProblemBuild build = buildNativeFromDataModel(arena, dm); + return solveAndExtract(arena, build, settings, dm.constraintMatrixOffsets() == null + ? 0 : Math.max(0, dm.constraintMatrixOffsets().length - 1), + dm.objectiveCoefficients() == null ? 0 : dm.objectiveCoefficients().length); + } + } + + // ── native problem construction from Problem (modeling API) ── + + private static final class ProblemBuild { + long problemHandle; + int numVariables; + int numConstraints; + + ProblemBuild(long handle, int numVariables, int numConstraints) { + this.problemHandle = handle; + this.numVariables = numVariables; + this.numConstraints = numConstraints; + } + } + + private ProblemBuild buildNativeProblem(Arena arena, Problem problem) { + int numV = problem.numVariables(); + int numC = problem.numConstraints(); + + // Variable bounds + types + double[] varLb = new double[numV]; + double[] varUb = new double[numV]; + byte[] varTypes = new byte[numV]; + boolean anyBinary = false; + for (int i = 0; i < numV; i++) { + Variable v = problem.getVariable(i); + varLb[i] = v.lowerBound(); + varUb[i] = v.upperBound(); + varTypes[i] = (byte) v.variableType().code(); + if (v.variableType() == VType.BINARY) anyBinary = true; + } + // BINARY is INTEGER with bounds clamped to [0, 1]. The user may + // already have set these bounds, but enforce here too. + if (anyBinary) { + for (int i = 0; i < numV; i++) { + if (problem.getVariable(i).variableType() == VType.BINARY) { + if (Double.isNaN(varLb[i]) || varLb[i] < 0.0) varLb[i] = 0.0; + if (Double.isNaN(varUb[i]) || varUb[i] > 1.0) varUb[i] = 1.0; + } + } + } + + // Build constraint CSR from per-constraint LinearExprs. + List rows = problem.constraintExpressions(); + CsrBuilder.Csr ccsr = CsrBuilder.buildConstraintCsr(rows); + + // Constraint sense + rhs from the Constraint metadata. + byte[] sense = new byte[numC]; + double[] rhs = new double[numC]; + for (int i = 0; i < numC; i++) { + Constraint c = problem.getConstraint(i); + sense[i] = (byte) c.sense().code(); + rhs[i] = c.rhs(); + } + + // Objective coefficients from linear / linear-part-of-quadratic. + double[] objCoeffs = new double[numV]; + LinearExpr objLinear = problem.linearObjective() != null + ? problem.linearObjective() + : problem.quadraticObjective() != null + ? problem.quadraticObjective().linearPart() + : null; + if (objLinear != null) { + for (var e : objLinear.terms().entrySet()) { + objCoeffs[e.getKey().index()] += e.getValue(); + } + } + + // Allocate and copy into native segments. + MemorySegment objCoeffsSeg = doubleArray(arena, objCoeffs); + MemorySegment rowOffsetsSeg = intArray(arena, ccsr.rowOffsets); + MemorySegment colIndicesSeg = intArray(arena, ccsr.colIndices); + MemorySegment ccoeffsSeg = doubleArray(arena, ccsr.values); + MemorySegment senseSeg = byteArray(arena, sense); + MemorySegment rhsSeg = doubleArray(arena, rhs); + MemorySegment lbSeg = doubleArray(arena, varLb); + MemorySegment ubSeg = doubleArray(arena, varUb); + MemorySegment varTypesSeg = byteArray(arena, varTypes); + MemorySegment problemPtr = arena.allocate(ValueLayout.ADDRESS); + + int sense_code = problem.objectiveSense().code(); + double offset = problem.objectiveOffset(); + + int rc; + if (problem.isQp() && problem.quadraticObjective() != null) { + QuadraticExpr q = problem.quadraticObjective(); + CsrBuilder.Csr qcsr = CsrBuilder.buildQuadraticCsr(q, numV); + MemorySegment qRowOff = intArray(arena, qcsr.rowOffsets); + MemorySegment qColIdx = intArray(arena, qcsr.colIndices); + MemorySegment qVals = doubleArray(arena, qcsr.values); + rc = cuopt_c_h.cuOptCreateQuadraticProblem( + numC, numV, sense_code, offset, objCoeffsSeg, + qRowOff, qColIdx, qVals, + rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, + senseSeg, rhsSeg, lbSeg, ubSeg, problemPtr); + checkRc(rc, "cuOptCreateQuadraticProblem"); + } else { + rc = cuopt_c_h.cuOptCreateProblem( + numC, numV, sense_code, offset, objCoeffsSeg, + rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, + senseSeg, rhsSeg, lbSeg, ubSeg, varTypesSeg, problemPtr); + checkRc(rc, "cuOptCreateProblem"); + } + + long handle = problemPtr.get(ValueLayout.ADDRESS, 0).address(); + return new ProblemBuild(handle, numV, numC); + } + + private ProblemBuild buildNativeFromDataModel(Arena arena, DataModel dm) { + int numV = dm.objectiveCoefficients() == null ? 0 : dm.objectiveCoefficients().length; + int numC = dm.constraintMatrixOffsets() == null + ? 0 : Math.max(0, dm.constraintMatrixOffsets().length - 1); + + MemorySegment objCoeffsSeg = doubleArray(arena, dm.objectiveCoefficients()); + MemorySegment rowOffsetsSeg = intArray(arena, dm.constraintMatrixOffsets()); + MemorySegment colIndicesSeg = intArray(arena, dm.constraintMatrixIndices()); + MemorySegment ccoeffsSeg = doubleArray(arena, dm.constraintMatrixValues()); + + double[] varLb = dm.variableLowerBounds() != null + ? dm.variableLowerBounds() : zeros(numV); + double[] varUb = dm.variableUpperBounds() != null + ? dm.variableUpperBounds() : positiveInfinities(numV); + MemorySegment lbSeg = doubleArray(arena, varLb); + MemorySegment ubSeg = doubleArray(arena, varUb); + + byte[] varTypeArr = new byte[numV]; + if (dm.variableTypes() != null) { + for (int i = 0; i < numV; i++) { + varTypeArr[i] = (byte) dm.variableTypes()[i].code(); + } + } else { + java.util.Arrays.fill(varTypeArr, (byte) 'C'); + } + MemorySegment varTypesSeg = byteArray(arena, varTypeArr); + + int senseCode = dm.maximize() ? -1 : 1; + double offset = dm.objectiveOffset(); + MemorySegment problemPtr = arena.allocate(ValueLayout.ADDRESS); + + boolean ranged = dm.constraintLowerBounds() != null || dm.constraintUpperBounds() != null; + boolean quadratic = dm.quadraticObjectiveOffsets() != null + && dm.quadraticObjectiveOffsets().length > 0; + + int rc; + if (quadratic && ranged) { + rc = cuopt_c_h.cuOptCreateQuadraticRangedProblem( + numC, numV, senseCode, offset, objCoeffsSeg, + intArray(arena, dm.quadraticObjectiveOffsets()), + intArray(arena, dm.quadraticObjectiveIndices()), + doubleArray(arena, dm.quadraticObjectiveValues()), + rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, + doubleArray(arena, dm.constraintLowerBounds()), + doubleArray(arena, dm.constraintUpperBounds()), + lbSeg, ubSeg, problemPtr); + checkRc(rc, "cuOptCreateQuadraticRangedProblem"); + } else if (quadratic) { + byte[] senseArr = ctypesToBytes(dm.rowTypes(), numC); + double[] rhsArr = dm.constraintBoundsArray() != null + ? dm.constraintBoundsArray() : zeros(numC); + rc = cuopt_c_h.cuOptCreateQuadraticProblem( + numC, numV, senseCode, offset, objCoeffsSeg, + intArray(arena, dm.quadraticObjectiveOffsets()), + intArray(arena, dm.quadraticObjectiveIndices()), + doubleArray(arena, dm.quadraticObjectiveValues()), + rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, + byteArray(arena, senseArr), doubleArray(arena, rhsArr), + lbSeg, ubSeg, problemPtr); + checkRc(rc, "cuOptCreateQuadraticProblem"); + } else if (ranged) { + rc = cuopt_c_h.cuOptCreateRangedProblem( + numC, numV, senseCode, offset, objCoeffsSeg, + rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, + doubleArray(arena, dm.constraintLowerBounds()), + doubleArray(arena, dm.constraintUpperBounds()), + lbSeg, ubSeg, varTypesSeg, problemPtr); + checkRc(rc, "cuOptCreateRangedProblem"); + } else { + byte[] senseArr = ctypesToBytes(dm.rowTypes(), numC); + double[] rhsArr = dm.constraintBoundsArray() != null + ? dm.constraintBoundsArray() : zeros(numC); + rc = cuopt_c_h.cuOptCreateProblem( + numC, numV, senseCode, offset, objCoeffsSeg, + rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, + byteArray(arena, senseArr), doubleArray(arena, rhsArr), + lbSeg, ubSeg, varTypesSeg, problemPtr); + checkRc(rc, "cuOptCreateProblem"); + } + + long handle = problemPtr.get(ValueLayout.ADDRESS, 0).address(); + return new ProblemBuild(handle, numV, numC); + } + + // ── solve + extract ───────────────────────────────────────── + + private SolveResult solveAndExtract(Arena arena, Problem problem, + ProblemBuild build, SolverSettings settings) { + return solveAndExtract(arena, build, settings, build.numConstraints, build.numVariables, + problem); + } + + private SolveResult solveAndExtract(Arena arena, ProblemBuild build, + SolverSettings settings, int numC, int numV) { + return solveAndExtract(arena, build, settings, numC, numV, null); + } + + private SolveResult solveAndExtract(Arena arena, ProblemBuild build, + SolverSettings settings, int numC, int numV, + Problem problemForSlack) { + long settingsHandle = settings != null ? settings.nativeHandle() : createSolverSettings(); + boolean ownSettingsHandle = (settings == null); + try { + MemorySegment solPtr = arena.allocate(ValueLayout.ADDRESS); + int rc = cuopt_c_h.cuOptSolve( + MemorySegment.ofAddress(build.problemHandle), + MemorySegment.ofAddress(settingsHandle), + solPtr); + checkRc(rc, "cuOptSolve"); + MemorySegment solutionHandle = solPtr.get(ValueLayout.ADDRESS, 0); + + try { + // Termination + error + MemorySegment outInt = arena.allocate(ValueLayout.JAVA_INT); + cuopt_c_h.cuOptGetTerminationStatus(solutionHandle, outInt); + TerminationStatus term = TerminationStatus.fromCode(outInt.get(ValueLayout.JAVA_INT, 0)); + + cuopt_c_h.cuOptGetErrorStatus(solutionHandle, outInt); + ErrorStatus err = ErrorStatus.fromCode(outInt.get(ValueLayout.JAVA_INT, 0)); + + String errMsg = null; + if (err != ErrorStatus.SUCCESS) { + MemorySegment buf = arena.allocate(1024); + cuopt_c_h.cuOptGetErrorString(solutionHandle, buf, 1024); + errMsg = buf.getString(0); + if (errMsg != null && errMsg.isEmpty()) errMsg = null; + } + + // Primal / dual / reduced cost + double[] primal = new double[numV]; + if (numV > 0) { + MemorySegment primalSeg = arena.allocate( + ValueLayout.JAVA_DOUBLE.byteSize() * numV); + cuopt_c_h.cuOptGetPrimalSolution(solutionHandle, primalSeg); + MemorySegment.copy(primalSeg, ValueLayout.JAVA_DOUBLE, 0, primal, 0, numV); + } + + double[] dual = null; + double[] reduced = null; + // cuOptIsMIP determines whether dual is meaningful. + MemorySegment isMipPtr = arena.allocate(ValueLayout.JAVA_INT); + cuopt_c_h.cuOptIsMIP(MemorySegment.ofAddress(build.problemHandle), isMipPtr); + boolean isMip = isMipPtr.get(ValueLayout.JAVA_INT, 0) != 0; + + if (!isMip && numC > 0) { + dual = new double[numC]; + MemorySegment dualSeg = arena.allocate( + ValueLayout.JAVA_DOUBLE.byteSize() * numC); + cuopt_c_h.cuOptGetDualSolution(solutionHandle, dualSeg); + MemorySegment.copy(dualSeg, ValueLayout.JAVA_DOUBLE, 0, dual, 0, numC); + } + + if (!isMip && numV > 0) { + reduced = new double[numV]; + MemorySegment rcSeg = arena.allocate( + ValueLayout.JAVA_DOUBLE.byteSize() * numV); + cuopt_c_h.cuOptGetReducedCosts(solutionHandle, rcSeg); + MemorySegment.copy(rcSeg, ValueLayout.JAVA_DOUBLE, 0, reduced, 0, numV); + } + + // Slack (computed Java-side from primal + constraint expressions) + double[] slack = (problemForSlack != null && numC > 0) + ? computeSlackFromExpressions(problemForSlack, primal) : null; + + // Objective values + time + MemorySegment outDbl = arena.allocate(ValueLayout.JAVA_DOUBLE); + cuopt_c_h.cuOptGetObjectiveValue(solutionHandle, outDbl); + double objVal = outDbl.get(ValueLayout.JAVA_DOUBLE, 0); + + double dualObjVal = Double.NaN; + if (!isMip) { + cuopt_c_h.cuOptGetDualObjectiveValue(solutionHandle, outDbl); + dualObjVal = outDbl.get(ValueLayout.JAVA_DOUBLE, 0); + } + + cuopt_c_h.cuOptGetSolveTime(solutionHandle, outDbl); + double solveTime = outDbl.get(ValueLayout.JAVA_DOUBLE, 0); + + // Stats — LP and MIP. We populate what's readily available; + // missing fields are NaN / -1. + LpStats lpStats = new LpStats( + Double.NaN, Double.NaN, objVal, dualObjVal, -1L, Double.NaN); + + MilpStats milpStats = null; + if (isMip) { + cuopt_c_h.cuOptGetMIPGap(solutionHandle, outDbl); + double mipGap = outDbl.get(ValueLayout.JAVA_DOUBLE, 0); + cuopt_c_h.cuOptGetSolutionBound(solutionHandle, outDbl); + double bound = outDbl.get(ValueLayout.JAVA_DOUBLE, 0); + milpStats = new MilpStats(mipGap, bound, -1L, -1L, Double.NaN, Double.NaN); + } + + return new SolveResult( + primal, dual, reduced, slack, + term, term.name(), err, errMsg, + objVal, dualObjVal, solveTime, + SolverMethod.UNSET, + lpStats, milpStats); + } finally { + MemorySegment solDestroyPtr = arena.allocate(ValueLayout.ADDRESS); + solDestroyPtr.set(ValueLayout.ADDRESS, 0, solutionHandle); + cuopt_c_h.cuOptDestroySolution(solDestroyPtr); + } + } finally { + // Destroy the problem handle we built. + MemorySegment probDestroyPtr = arena.allocate(ValueLayout.ADDRESS); + probDestroyPtr.set(ValueLayout.ADDRESS, 0, + MemorySegment.ofAddress(build.problemHandle)); + cuopt_c_h.cuOptDestroyProblem(probDestroyPtr); + if (ownSettingsHandle) destroySolverSettings(settingsHandle); + } + } + + // ── helpers ────────────────────────────────────────────────── + + private static double[] computeSlackFromExpressions(Problem p, double[] primal) { + List rows = p.constraintExpressions(); + double[] slack = new double[rows.size()]; + for (int i = 0; i < rows.size(); i++) { + double lhs = 0.0; + for (var e : rows.get(i).terms().entrySet()) { + lhs += primal[e.getKey().index()] * e.getValue(); + } + Constraint c = p.getConstraint(i); + // Slack convention: rhs - lhs (positive for satisfied <= constraints). + slack[i] = c.rhs() - lhs; + } + return slack; + } + + private static MemorySegment cString(Arena arena, String s) { + if (s == null) return MemorySegment.NULL; + byte[] bytes = s.getBytes(StandardCharsets.UTF_8); + MemorySegment seg = arena.allocate(bytes.length + 1); + MemorySegment.copy(bytes, 0, seg, ValueLayout.JAVA_BYTE, 0, bytes.length); + seg.set(ValueLayout.JAVA_BYTE, bytes.length, (byte) 0); + return seg; + } + + private static MemorySegment doubleArray(Arena arena, double[] arr) { + if (arr == null || arr.length == 0) return MemorySegment.NULL; + MemorySegment seg = arena.allocate(ValueLayout.JAVA_DOUBLE.byteSize() * arr.length); + MemorySegment.copy(arr, 0, seg, ValueLayout.JAVA_DOUBLE, 0, arr.length); + return seg; + } + + private static MemorySegment intArray(Arena arena, int[] arr) { + if (arr == null || arr.length == 0) return MemorySegment.NULL; + MemorySegment seg = arena.allocate(ValueLayout.JAVA_INT.byteSize() * arr.length); + MemorySegment.copy(arr, 0, seg, ValueLayout.JAVA_INT, 0, arr.length); + return seg; + } + + private static MemorySegment byteArray(Arena arena, byte[] arr) { + if (arr == null || arr.length == 0) return MemorySegment.NULL; + MemorySegment seg = arena.allocate(arr.length); + MemorySegment.copy(arr, 0, seg, ValueLayout.JAVA_BYTE, 0, arr.length); + return seg; + } + + private static byte[] ctypesToBytes(CType[] types, int n) { + byte[] out = new byte[n]; + if (types == null) { + java.util.Arrays.fill(out, (byte) 'L'); + } else { + for (int i = 0; i < n; i++) out[i] = (byte) types[i].code(); + } + return out; + } + + private static double[] zeros(int n) { + return new double[n]; + } + + private static double[] positiveInfinities(int n) { + double[] out = new double[n]; + java.util.Arrays.fill(out, Double.POSITIVE_INFINITY); + return out; + } + + private static void checkRc(int rc, String op) { + if (rc != 0) { + ErrorStatus err = ErrorStatus.fromCode(rc); + throw new CuOptException(op + " returned non-zero status " + rc + " (" + err + ")"); + } + } } diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java new file mode 100644 index 0000000000..0dfa8f31fc --- /dev/null +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java @@ -0,0 +1,64 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import static com.nvidia.cuopt.CuOpt.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +class LinearExprTest { + + @Test + void addTerm_and_addTerms_are_interchangeable() { + try (var p = new Problem()) { + Variable x = p.addVariable(0, INF, CONTINUOUS, "x"); + Variable y = p.addVariable(0, INF, CONTINUOUS, "y"); + Variable z = p.addVariable(0, INF, CONTINUOUS, "z"); + + LinearExpr a = new LinearExpr() + .addTerm(2.0, x).addTerm(3.0, y).addTerm(1.0, z); + + LinearExpr b = new LinearExpr() + .addTerms(new double[]{2.0, 3.0, 1.0}, new Variable[]{x, y, z}); + + assertEquals(a.numTerms(), b.numTerms()); + assertEquals(a.terms(), b.terms()); + } + } + + @Test + void same_variable_coefficients_accumulate() { + try (var p = new Problem()) { + Variable x = p.addVariable(0, INF, CONTINUOUS, "x"); + LinearExpr e = new LinearExpr() + .addTerm(2.0, x).addTerm(3.0, x); + assertEquals(1, e.numTerms()); + assertEquals(5.0, e.terms().get(x), 1e-12); + } + } + + @Test + void length_mismatch_throws() { + try (var p = new Problem()) { + Variable x = p.addVariable(0, INF, CONTINUOUS, "x"); + LinearExpr e = new LinearExpr(); + assertThrows(IllegalArgumentException.class, + () -> e.addTerms(new double[]{1.0, 2.0}, new Variable[]{x})); + } + } + + @Test + void mixed_problem_variables_throws() { + try (var p1 = new Problem(); var p2 = new Problem()) { + Variable x1 = p1.addVariable(0, INF, CONTINUOUS, "x1"); + Variable x2 = p2.addVariable(0, INF, CONTINUOUS, "x2"); + LinearExpr e = new LinearExpr().addTerm(1.0, x1); + assertThrows(IllegalArgumentException.class, + () -> e.addTerm(1.0, x2)); + } + } +} diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverTest.java new file mode 100644 index 0000000000..519e8850d1 --- /dev/null +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverTest.java @@ -0,0 +1,111 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import static com.nvidia.cuopt.CuOpt.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +class LpSolverTest { + + /** + * Minimal LP that mirrors the cuOpt Python LP solver test in + * {@code test_lp_solver.py::test_solver}. + */ + @Test + void simpleLpSolveToOptimal() { + try (var problem = new Problem("test_lp"); + var settings = new SolverSettings() + .setOptimalityTolerance(1e-2) + .setMethod(SolverMethod.PDLP)) { + + Variable x1 = problem.addVariable(0.0, INF, CONTINUOUS, "x1"); + Variable x2 = problem.addVariable(0.0, INF, CONTINUOUS, "x2"); + + // x1 + x2 <= 1.0 (twice to mirror the Python test's offsets array [0,1,2]) + LinearExpr c1 = new LinearExpr().addTerm(1.0, x1); + problem.addConstraint(c1, LESS_EQUAL, 1.0, "c1"); + LinearExpr c2 = new LinearExpr().addTerm(1.0, x1); + problem.addConstraint(c2, LESS_EQUAL, 1.0, "c2"); + + // minimize x1 + LinearExpr obj = new LinearExpr().addTerm(1.0, x1); + problem.setObjective(obj, MINIMIZE); + + problem.solve(settings); + + assertEquals(TerminationStatus.OPTIMAL, problem.status(), + "expected OPTIMAL; got " + problem.terminationReason()); + assertEquals(0.0, x1.value(), 1e-6); + assertEquals(0.0, problem.objectiveValue(), 1e-6); + assertTrue(problem.solveTime() >= 0.0); + } + } + + @Test + void diet_lp_optimal_objective() { + // Diet problem (toy LP): + // min 1.5*bread + 0.8*milk + // s.t. 2*bread + 3*milk >= 50 (calories) + // 1*bread + 4*milk >= 12 (protein) + // 0 <= bread <= 10 + // 0 <= milk <= 10 + try (var problem = new Problem("diet")) { + Variable bread = problem.addVariable(0, 10, CONTINUOUS, "bread"); + Variable milk = problem.addVariable(0, 10, CONTINUOUS, "milk"); + + LinearExpr calories = new LinearExpr() + .addTerm(2.0, bread).addTerm(3.0, milk); + problem.addConstraint(calories, GREATER_EQUAL, 50.0, "calories"); + + LinearExpr protein = new LinearExpr() + .addTerm(1.0, bread).addTerm(4.0, milk); + problem.addConstraint(protein, GREATER_EQUAL, 12.0, "protein"); + + LinearExpr cost = new LinearExpr() + .addTerm(1.5, bread).addTerm(0.8, milk); + problem.setObjective(cost, MINIMIZE); + + problem.solve(); + + // We don't pin the objective to an exact value (numerical + // tolerances vary), but it should be feasible and finite. + assertEquals(TerminationStatus.OPTIMAL, problem.status(), + "diet LP should be feasible and optimal"); + double obj = problem.objectiveValue(); + assertTrue(Double.isFinite(obj)); + assertTrue(obj >= 0.0); + // Values should be within bounds. + assertTrue(bread.value() >= -1e-6 && bread.value() <= 10.0 + 1e-6); + assertTrue(milk.value() >= -1e-6 && milk.value() <= 10.0 + 1e-6); + } + } + + @Test + void problem_introspection_reflects_build_state() { + try (var problem = new Problem("introspection")) { + assertEquals(0, problem.numVariables()); + assertEquals(0, problem.numConstraints()); + assertEquals(0, problem.numNonZeros()); + + Variable x = problem.addVariable(0, 5, CONTINUOUS, "x"); + Variable y = problem.addVariable(0, 5, CONTINUOUS, "y"); + assertEquals(2, problem.numVariables()); + + problem.addConstraint( + new LinearExpr().addTerm(1, x).addTerm(1, y), + LESS_EQUAL, 10.0, "c"); + assertEquals(1, problem.numConstraints()); + assertEquals(2, problem.numNonZeros()); + + assertEquals(ProblemCategory.LP, problem.problemCategory()); + assertNotNull(problem.getVariable("x")); + assertEquals(x, problem.getVariable("x")); + } + } +} diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverTest.java new file mode 100644 index 0000000000..a12de55ae1 --- /dev/null +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverTest.java @@ -0,0 +1,63 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import static com.nvidia.cuopt.CuOpt.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +class MilpSolverTest { + + @Test + void simple_knapsack_binary_milp() { + // 0-1 knapsack: + // maximize Σ vᵢ·xᵢ + // s.t. Σ wᵢ·xᵢ <= capacity + // xᵢ in {0, 1} + double[] values = {8.0, 4.0, 12.0, 3.0, 9.0}; + double[] weights = {5.0, 3.0, 8.0, 2.0, 6.0}; + double capacity = 15.0; + int n = values.length; + + try (var problem = new Problem("knapsack"); + var settings = new SolverSettings() + .setTimeLimit(30.0) + .setRelativeMipGap(0.01)) { + + Variable[] x = new Variable[n]; + for (int i = 0; i < n; i++) { + x[i] = problem.addVariable(0, 1, INTEGER, "x" + i); + } + + LinearExpr cap = new LinearExpr().addTerms(weights, x); + problem.addConstraint(cap, LESS_EQUAL, capacity, "capacity"); + + LinearExpr obj = new LinearExpr().addTerms(values, x); + problem.setObjective(obj, MAXIMIZE); + + problem.solve(settings); + + assertTrue(problem.isMip()); + // Termination should be OPTIMAL, FEASIBLE_FOUND, or a limit. + TerminationStatus s = problem.status(); + assertTrue(s == TerminationStatus.OPTIMAL + || s == TerminationStatus.FEASIBLE_FOUND + || s == TerminationStatus.PRIMAL_FEASIBLE, + "MIP should find a feasible solution, got " + s); + + // Values must be near 0 or 1. + for (int i = 0; i < n; i++) { + double v = x[i].value(); + assertTrue(v < 0.5 || v > 0.5, + "x[" + i + "] should be near 0 or 1, was " + v); + } + + // MILP stats should be present. + assertTrue(problem.milpStats().isPresent()); + } + } +} diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverTest.java new file mode 100644 index 0000000000..c36268897c --- /dev/null +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverTest.java @@ -0,0 +1,56 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import static com.nvidia.cuopt.CuOpt.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +class QpSolverTest { + + /** + * Mirrors cuOpt Python {@code test_qp.py::test_solver}: + * minimize x1^2 + 4*x2^2 - 8*x1 - 16*x2 + * s.t. x1 + x2 >= 5 + * x1 >= 3 + * x2 >= 0 + */ + @Test + void simple_qp_minimize() { + try (var problem = new Problem("qp_test")) { + Variable x1 = problem.addVariable(3.0, 10.0, CONTINUOUS, "x1"); + Variable x2 = problem.addVariable(0.0, 10.0, CONTINUOUS, "x2"); + + LinearExpr c = new LinearExpr() + .addTerm(1.0, x1).addTerm(1.0, x2); + problem.addConstraint(c, GREATER_EQUAL, 5.0, "sum"); + + QuadraticExpr obj = new QuadraticExpr() + .addQuadraticTerm(1.0, x1, x1) + .addQuadraticTerm(4.0, x2, x2) + .addTerm(-8.0, x1) + .addTerm(-16.0, x2); + problem.setObjective(obj, MINIMIZE); + + assertEquals(ProblemCategory.QP, problem.problemCategory()); + + problem.solve(); + + // QP should terminate with OPTIMAL or a feasible status. + TerminationStatus s = problem.status(); + assertTrue(s == TerminationStatus.OPTIMAL + || s == TerminationStatus.PRIMAL_FEASIBLE, + "QP should be feasible and optimal, got " + s); + + // Solution within bounds. + assertTrue(x1.value() >= 3.0 - 1e-6); + assertTrue(x2.value() >= 0.0 - 1e-6); + assertTrue(x1.value() + x2.value() >= 5.0 - 1e-6, + "sum constraint should be satisfied"); + } + } +} From 92daba7c78dc1efa799410bf1def2a573fafba84 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Mon, 11 May 2026 13:31:41 -0500 Subject: [PATCH 04/28] java: auto-download jextract on first build (cuvs pattern) jextract for JDK 22 is not on conda-forge. Match cuvs's approach of auto-downloading it into java/panama-bindings/jextract-22/ on first run of generate-bindings.sh. - panama-bindings/generate-bindings.sh now downloads openjdk-22-jextract+6-47 from download.java.net if jextract isn't already on PATH. Subsequent builds reuse the local copy. - panama-bindings/.gitignore excludes jextract-22/ and the .tar.gz download artifact from git. - build.sh drops the hard error on missing jextract; the auto-download in generate-bindings.sh handles it. - README and dependencies.yaml comments updated to reflect the auto-download. CI implication: the first 'ci/build_java.sh' run will spend ~10 seconds downloading jextract (62 MB). Subsequent runs cache it in the conda env's workspace if persistent, or re-download otherwise. A follow-up could preinstall jextract in the rapidsai/ci-conda image to skip the download in CI. --- dependencies.yaml | 6 +- java/README.md | 5 ++ java/build.sh | 9 +-- java/panama-bindings/.gitignore | 2 + java/panama-bindings/generate-bindings.sh | 71 ++++++++++++++--------- 5 files changed, 58 insertions(+), 35 deletions(-) create mode 100644 java/panama-bindings/.gitignore diff --git a/dependencies.yaml b/dependencies.yaml index 5f9421e961..759d1dbfa7 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -329,8 +329,10 @@ dependencies: # See java/README.md for the full multi-release-JAR rationale. - openjdk=22.* - maven>=3.9.6 - # jextract is not available on conda-forge; java/build.sh expects - # it to be installed manually. See java/README.md. + # jextract is not on conda-forge. java/panama-bindings/ + # generate-bindings.sh auto-downloads it (cuvs pattern). For + # CI to be hermetic, consider preinstalling jextract in the + # ci-conda image; for now, the build pulls it on first run. test_cpp_cuopt: common: - output_types: [conda] diff --git a/java/README.md b/java/README.md index 927a6b05e8..24d5105597 100644 --- a/java/README.md +++ b/java/README.md @@ -68,6 +68,11 @@ Prerequisites: - Maven 3.9.6+ (`conda install -c conda-forge maven`) - A built `libcuopt.so` (from `../cpp/build/`) +**jextract** is not available on conda-forge — `panama-bindings/generate-bindings.sh` +auto-downloads `openjdk-22-jextract+6-47` from `download.java.net` on first +run and extracts it to `panama-bindings/jextract-22/` (gitignored). Subsequent +builds reuse the local copy. Set `JEXTRACT=/path/to/jextract` to override. + ```bash # Build libcuopt.so first if not already built cd /path/to/cuopt diff --git a/java/build.sh b/java/build.sh index 980ffbf936..ca62f8fa57 100755 --- a/java/build.sh +++ b/java/build.sh @@ -57,13 +57,8 @@ if ! command -v mvn >/dev/null 2>&1; then exit 1 fi -if ! command -v "${JEXTRACT}" >/dev/null 2>&1; then - echo "ERROR: jextract not found at '${JEXTRACT}'." >&2 - echo " Download jextract for JDK 22 from:" >&2 - echo " https://jdk.java.net/jextract/" >&2 - echo " Then set JEXTRACT to the binary path, or add it to PATH." >&2 - exit 1 -fi +# jextract is auto-downloaded by panama-bindings/generate-bindings.sh +# on first run (cuvs pattern). No need to require it on PATH here. # 2. libcuopt.so check if [[ ! -f "${CMAKE_PREFIX_PATH}/libcuopt.so" ]]; then diff --git a/java/panama-bindings/.gitignore b/java/panama-bindings/.gitignore new file mode 100644 index 0000000000..91672b2fd7 --- /dev/null +++ b/java/panama-bindings/.gitignore @@ -0,0 +1,2 @@ +jextract-22/ +openjdk-22-jextract*.tar.gz diff --git a/java/panama-bindings/generate-bindings.sh b/java/panama-bindings/generate-bindings.sh index 40213dddbd..624c59632e 100755 --- a/java/panama-bindings/generate-bindings.sh +++ b/java/panama-bindings/generate-bindings.sh @@ -5,52 +5,71 @@ # Regenerates Panama bindings for cuOpt's C API into # cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/. # -# Inputs: -# $JEXTRACT Path to the jextract binary (set by build.sh, or in PATH). -# $CUOPT_INCLUDE Path to cpp/include (defaults to ../../cpp/include). -# $CUDA_INCLUDE Path to CUDA include dir (defaults to /usr/local/cuda/include). +# Auto-downloads jextract for JDK 22 into ./jextract-22/ on first run +# (cuvs pattern). Subsequent runs reuse the local copy. Pass JEXTRACT +# explicitly to use an externally-installed jextract. # -# Output: regenerates files under -# ../cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/ +# Inputs: +# JEXTRACT Path to a jextract binary. Default: search PATH (and +# the local ./jextract-22/bin/). +# CUOPT_INCLUDE Path to cpp/include (defaults to ../../cpp/include). +# CUDA_INCLUDE_DIR Path to CUDA include dir. Default: $CONDA_PREFIX/ +# targets/x86_64-linux/include if present, else +# /usr/local/cuda/include. set -euo pipefail CURDIR="$(cd "$(dirname "$0")" && pwd)" REPODIR="$(cd "${CURDIR}/../.." && pwd)" -JEXTRACT="${JEXTRACT:-jextract}" CUOPT_INCLUDE="${CUOPT_INCLUDE:-${REPODIR}/cpp/include}" -CUDA_INCLUDE="${CUDA_INCLUDE:-/usr/local/cuda/include}" - OUTPUT_DIR="${REPODIR}/java/cuopt-java/src/main/java22" TARGET_PACKAGE="com.nvidia.cuopt.internal.panama" -# Sanity checks -if ! command -v "${JEXTRACT}" >/dev/null 2>&1; then - echo "ERROR: jextract not found at '${JEXTRACT}'." >&2 - echo " Run build.sh from the java/ directory to auto-download it," >&2 - echo " or set JEXTRACT to the path of an installed jextract binary." >&2 - exit 1 +# CUDA include detection — prefer the conda env's CUDA toolkit if active. +TARGET_DIR="targets/x86_64-linux/include" +if [[ -z "${CUDA_INCLUDE_DIR:-}" ]]; then + if [[ -n "${CONDA_PREFIX:-}" ]] && [[ -d "${CONDA_PREFIX}/${TARGET_DIR}" ]]; then + CUDA_INCLUDE_DIR="${CONDA_PREFIX}/${TARGET_DIR}" + elif [[ -d "/usr/local/cuda/${TARGET_DIR}" ]]; then + CUDA_INCLUDE_DIR="/usr/local/cuda/${TARGET_DIR}" + elif [[ -d "/usr/local/cuda/include" ]]; then + CUDA_INCLUDE_DIR="/usr/local/cuda/include" + else + echo "ERROR: Could not locate a CUDA include directory." >&2 + echo " Set CUDA_INCLUDE_DIR explicitly." >&2 + exit 1 + fi fi -if [[ ! -d "${CUOPT_INCLUDE}" ]]; then - echo "ERROR: cuopt include dir not found at '${CUOPT_INCLUDE}'." >&2 - exit 1 +# Auto-download jextract (cuvs pattern): prepend local ./jextract-22/bin/ +# to PATH, then check if jextract is reachable. If not, download. +PATH="${CURDIR}/jextract-22/bin:${PATH}" +export PATH + +JEXTRACT="${JEXTRACT:-jextract}" +if ! command -v "${JEXTRACT}" >/dev/null 2>&1; then + JEXTRACT_FILENAME="openjdk-22-jextract+6-47_linux-x64_bin.tar.gz" + JEXTRACT_DOWNLOAD_URL="https://download.java.net/java/early_access/jextract/22/6/${JEXTRACT_FILENAME}" + echo "jextract not found. Downloading from ${JEXTRACT_DOWNLOAD_URL} ..." + ( + cd "${CURDIR}" + wget -c "${JEXTRACT_DOWNLOAD_URL}" + tar -xzf "./${JEXTRACT_FILENAME}" + echo "jextract installed to ${CURDIR}/jextract-22" + ) + # PATH was already updated above to include ${CURDIR}/jextract-22/bin fi -# Clean previous output to ensure removed symbols are actually removed +# Clean previous output so removed symbols actually disappear. PANAMA_DIR="${OUTPUT_DIR}/com/nvidia/cuopt/internal/panama" mkdir -p "${PANAMA_DIR}" find "${PANAMA_DIR}" -name '*.java' -delete 2>/dev/null || true -# Run jextract -# --library cuopt: the generated code dlopen's libcuopt.so -# --target-package: where the generated classes land -# --output: source directory for generated files -# --include-dir: search paths for #include resolution -"${JEXTRACT}" \ +echo "Running jextract ..." +jextract \ --include-dir "${CUOPT_INCLUDE}" \ - --include-dir "${CUDA_INCLUDE}" \ + --include-dir "${CUDA_INCLUDE_DIR}" \ --output "${OUTPUT_DIR}" \ --target-package "${TARGET_PACKAGE}" \ --library cuopt \ From 5b75bd2e2da68e16780943712413528df96aa0a2 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Mon, 11 May 2026 14:10:26 -0500 Subject: [PATCH 05/28] java: fix MR-JAR test path, libcuopt lookup, and commit panama bindings Five fixes to get the build green end-to-end: 1. jextract: pass --header-class-name cuopt_c_h so the generated header class is named what CuOptProviderImpl imports (default would be headers_h after the umbrella include filename). Also add --use-system-load-library so dlopen uses java.library.path. 2. Make package-private accessors PUBLIC across the internal/-vs-linear_programming/ package boundary: - Problem: linearObjective, quadraticObjective, objectiveSense, objectiveOffset, constraintExpressions - QuadraticExpr: quadVar1, quadVar2, quadCoeff - SolverSettings: nativeHandle - DataModel: all ~15 internal getters Java's package-visibility doesn't cross the package boundary the FFM impl needs to traverse. Marked with javadoc that these are for internal FFM use only. 3. Multi-Release JAR semantics only apply to classes loaded from an actual JAR file, NOT exploded target/classes/. So tests that touch the FFM impl can't run via maven-surefire-plugin against target/classes/. Moved them to *IT.java (failsafe convention) and configured maven-failsafe-plugin with classesDirectory pointing at the packaged JAR. Failsafe runs after package, so the JAR exists. LinearExprTest stays as a surefire test (pure Java, no FFM impl). SolverIT / LpSolverIT / MilpSolverIT / QpSolverIT run via failsafe. 4. build.sh: replace CMAKE_PREFIX_PATH with CUOPT_LIB_DIR. The previous default fell through to the user's conda env path (set by conda activate), missing the actual libcuopt.so in cpp/build/. Now we probe cpp/build/ and $CONDA_PREFIX/lib in that order. 5. Commit the jextract-generated panama bindings (cuopt_c_h.java, __fsid_t.java, cuOptMIPGetSolutionCallback.java, cuOptMIPSetSolutionCallback.java). These regenerate on every build and the drift gate enforces consistency from this commit forward. Verified locally: full pipeline runs clean with ./java/build.sh (no SKIP_DRIFT_CHECK needed after this commit) Test results: Surefire: 4/4 LinearExprTest pass Failsafe: 6/6 integration tests pass against libcuopt.so (LP, MILP, QP all solve to feasibility/optimality) --- java/build.sh | 28 +- java/cuopt-java/pom.xml | 31 +- .../cuopt/linear_programming/DataModel.java | 40 +- .../cuopt/linear_programming/Problem.java | 15 +- .../linear_programming/QuadraticExpr.java | 10 +- .../linear_programming/SolverSettings.java | 5 +- .../cuopt/internal/panama/__fsid_t.java | 159 + .../panama/cuOptMIPGetSolutionCallback.java | 69 + .../panama/cuOptMIPSetSolutionCallback.java | 69 + .../cuopt/internal/panama/cuopt_c_h.java | 23515 ++++++++++++++++ .../cuopt/{SolverTest.java => SolverIT.java} | 2 +- .../{LpSolverTest.java => LpSolverIT.java} | 2 +- ...{MilpSolverTest.java => MilpSolverIT.java} | 2 +- .../{QpSolverTest.java => QpSolverIT.java} | 2 +- java/panama-bindings/generate-bindings.sh | 2 + 15 files changed, 23906 insertions(+), 45 deletions(-) create mode 100644 java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/__fsid_t.java create mode 100644 java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuOptMIPGetSolutionCallback.java create mode 100644 java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuOptMIPSetSolutionCallback.java create mode 100644 java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuopt_c_h.java rename java/cuopt-java/src/test/java/com/nvidia/cuopt/{SolverTest.java => SolverIT.java} (96%) rename java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/{LpSolverTest.java => LpSolverIT.java} (99%) rename java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/{MilpSolverTest.java => MilpSolverIT.java} (98%) rename java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/{QpSolverTest.java => QpSolverIT.java} (98%) diff --git a/java/build.sh b/java/build.sh index ca62f8fa57..ecafbd63bf 100755 --- a/java/build.sh +++ b/java/build.sh @@ -16,8 +16,8 @@ # JEXTRACT Path to jextract binary. Default: search PATH. # CUOPT_INCLUDE Path to cuopt include dir. Default: ../cpp/include. # CUDA_INCLUDE Path to CUDA include dir. Default: /usr/local/cuda/include. -# CMAKE_PREFIX_PATH Prepended to LD_LIBRARY_PATH so libcuopt.so is found. -# Default: ../cpp/build. +# CUOPT_LIB_DIR Directory containing libcuopt.so. Default: ../cpp/build, +# or $CONDA_PREFIX/lib if libcuopt.so is installed there. # SKIP_DRIFT_CHECK If set to 'true', skips the panama drift gate. # Useful in initial-bootstrap commits before the # bindings are first committed. @@ -31,13 +31,25 @@ REPODIR="$(cd "${CURDIR}/.." && pwd)" JEXTRACT="${JEXTRACT:-jextract}" CUOPT_INCLUDE="${CUOPT_INCLUDE:-${REPODIR}/cpp/include}" -CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH:-${REPODIR}/cpp/build}" + +# Find libcuopt.so. Prefer explicit CUOPT_LIB_DIR; otherwise look in the +# local cpp/build/ (developer build) and the active conda env's lib/ +# (conda-installed libcuopt). +if [[ -z "${CUOPT_LIB_DIR:-}" ]]; then + if [[ -f "${REPODIR}/cpp/build/libcuopt.so" ]]; then + CUOPT_LIB_DIR="${REPODIR}/cpp/build" + elif [[ -n "${CONDA_PREFIX:-}" ]] && [[ -f "${CONDA_PREFIX}/lib/libcuopt.so" ]]; then + CUOPT_LIB_DIR="${CONDA_PREFIX}/lib" + else + CUOPT_LIB_DIR="${REPODIR}/cpp/build" + fi +fi echo "==> cuopt-java build" echo " REPODIR=${REPODIR}" echo " JEXTRACT=${JEXTRACT}" echo " CUOPT_INCLUDE=${CUOPT_INCLUDE}" -echo " CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" +echo " CUOPT_LIB_DIR=${CUOPT_LIB_DIR}" # 1. Toolchain checks if ! command -v java >/dev/null 2>&1; then @@ -61,11 +73,11 @@ fi # on first run (cuvs pattern). No need to require it on PATH here. # 2. libcuopt.so check -if [[ ! -f "${CMAKE_PREFIX_PATH}/libcuopt.so" ]]; then - echo "WARNING: libcuopt.so not found at ${CMAKE_PREFIX_PATH}/libcuopt.so" >&2 +if [[ ! -f "${CUOPT_LIB_DIR}/libcuopt.so" ]]; then + echo "WARNING: libcuopt.so not found at ${CUOPT_LIB_DIR}/libcuopt.so" >&2 echo " Tests will fail unless libcuopt is on java.library.path." >&2 fi -export LD_LIBRARY_PATH="${CMAKE_PREFIX_PATH}:${LD_LIBRARY_PATH:-}" +export LD_LIBRARY_PATH="${CUOPT_LIB_DIR}:${LD_LIBRARY_PATH:-}" # 3. Regenerate panama bindings echo "==> Regenerating panama bindings" @@ -91,7 +103,7 @@ cd "${CURDIR}/cuopt-java" if [[ "${SKIP_TESTS:-false}" == "true" ]]; then mvn clean package -DskipTests else - mvn clean verify -Djava.library.path="${CMAKE_PREFIX_PATH}" + mvn clean verify -Djava.library.path="${CUOPT_LIB_DIR}" fi echo "==> cuopt-java build complete" diff --git a/java/cuopt-java/pom.xml b/java/cuopt-java/pom.xml index e6b5009bae..895919b6c2 100644 --- a/java/cuopt-java/pom.xml +++ b/java/cuopt-java/pom.xml @@ -124,7 +124,10 @@ - + org.apache.maven.plugins maven-surefire-plugin @@ -133,6 +136,32 @@ --enable-native-access=ALL-UNNAMED + + + + org.apache.maven.plugins + maven-failsafe-plugin + 3.5.2 + + --enable-native-access=ALL-UNNAMED + ${project.build.directory}/${project.build.finalName}.jar + + + + + integration-test + verify + + + + diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java index 127bb3919e..5f917c81ab 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java @@ -258,25 +258,27 @@ void solveInternal(SolverSettings settings) { this.solved = true; } - // ── package-private accessors used by ProblemImpl ──────────── - - boolean maximize() { return maximize; } - double objectiveOffset() { return objectiveOffset; } - double[] objectiveCoefficients() { return objectiveCoefficients; } - double[] constraintMatrixValues() { return constraintMatrixValues; } - int[] constraintMatrixIndices() { return constraintMatrixIndices; } - int[] constraintMatrixOffsets() { return constraintMatrixOffsets; } - double[] quadraticObjectiveValues() { return quadraticObjectiveValues; } - int[] quadraticObjectiveIndices() { return quadraticObjectiveIndices; } - int[] quadraticObjectiveOffsets() { return quadraticObjectiveOffsets; } - double[] variableLowerBounds() { return variableLowerBounds; } - double[] variableUpperBounds() { return variableUpperBounds; } - double[] constraintLowerBounds() { return constraintLowerBounds; } - double[] constraintUpperBounds() { return constraintUpperBounds; } - double[] constraintBoundsArray() { return constraintBounds; } - CType[] rowTypes() { return rowTypes; } - VType[] variableTypes() { return variableTypes; } - String problemName() { return problemName; } + // ── internal accessors used by the FFM implementation + // (public for cross-package access from internal/; not part of + // the stable user-facing API — do not rely on these in user code) ─ + + public boolean maximize() { return maximize; } + public double objectiveOffset() { return objectiveOffset; } + public double[] objectiveCoefficients() { return objectiveCoefficients; } + public double[] constraintMatrixValues() { return constraintMatrixValues; } + public int[] constraintMatrixIndices() { return constraintMatrixIndices; } + public int[] constraintMatrixOffsets() { return constraintMatrixOffsets; } + public double[] quadraticObjectiveValues() { return quadraticObjectiveValues; } + public int[] quadraticObjectiveIndices() { return quadraticObjectiveIndices; } + public int[] quadraticObjectiveOffsets() { return quadraticObjectiveOffsets; } + public double[] variableLowerBounds() { return variableLowerBounds; } + public double[] variableUpperBounds() { return variableUpperBounds; } + public double[] constraintLowerBounds() { return constraintLowerBounds; } + public double[] constraintUpperBounds() { return constraintUpperBounds; } + public double[] constraintBoundsArray() { return constraintBounds; } + public CType[] rowTypes() { return rowTypes; } + public VType[] variableTypes() { return variableTypes; } + public String problemName() { return problemName; } @Override public void close() { diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java index e42b6a4002..f3b3ca9c90 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java @@ -350,26 +350,27 @@ public void close() { // inside ProblemImpl). Closing happens there. } - // ── package-private accessors used by ProblemImpl when building - // native problem ──────────────────────────────────────────── + // ── internal accessors used by the FFM implementation + // (public for cross-package access from internal/; not part of + // the stable user-facing API — do not rely on these in user code) ─ - LinearExpr linearObjective() { + public LinearExpr linearObjective() { return linearObjective; } - QuadraticExpr quadraticObjective() { + public QuadraticExpr quadraticObjective() { return quadraticObjective; } - Sense objectiveSense() { + public Sense objectiveSense() { return objectiveSense; } - double objectiveOffset() { + public double objectiveOffset() { return objectiveOffset; } - List constraintExpressions() { + public List constraintExpressions() { return java.util.Collections.unmodifiableList(constraintExpressions); } diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java index 2ec50fcde5..0df63ebdbe 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java @@ -114,17 +114,19 @@ public Problem owner() { return owner != null ? owner : linearPart.owner(); } - // ── package-private accessors for ProblemImpl ──────────────── + // ── internal accessors used by the FFM implementation + // (public for cross-package access from internal/; not part of + // the stable user-facing API — do not rely on these in user code) ─ - Variable quadVar1(int i) { + public Variable quadVar1(int i) { return qVar1.get(i); } - Variable quadVar2(int i) { + public Variable quadVar2(int i) { return qVar2.get(i); } - double quadCoeff(int i) { + public double quadCoeff(int i) { return qCoeff.get(i); } diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java index 4feb3ab9f5..e4e4c8218b 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java @@ -165,9 +165,10 @@ public Object getParameter(String name) { return parameters.get(name); } - // ── package-private accessors for ProblemImpl ──────────────── + // ── internal accessor used by the FFM implementation + // (public for cross-package access; not for user code) ──── - long nativeHandle() { + public long nativeHandle() { checkOpen(); return nativeHandle; } diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/__fsid_t.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/__fsid_t.java new file mode 100644 index 0000000000..0f538396e6 --- /dev/null +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/__fsid_t.java @@ -0,0 +1,159 @@ +// Generated by jextract + +package com.nvidia.cuopt.internal.panama; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +/** + * {@snippet lang=c : + * struct { + * int __val[2]; + * } + * } + */ +public class __fsid_t { + + __fsid_t() { + // Should not be called directly + } + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + MemoryLayout.sequenceLayout(2, cuopt_c_h.C_INT).withName("__val") + ).withName("$anon$155:12"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final SequenceLayout __val$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("__val")); + + /** + * Layout for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static final SequenceLayout __val$layout() { + return __val$LAYOUT; + } + + private static final long __val$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static final long __val$offset() { + return __val$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static MemorySegment __val(MemorySegment struct) { + return struct.asSlice(__val$OFFSET, __val$LAYOUT.byteSize()); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static void __val(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, __val$OFFSET, __val$LAYOUT.byteSize()); + } + + private static long[] __val$DIMS = { 2 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static long[] __val$dimensions() { + return __val$DIMS; + } + private static final VarHandle __val$ELEM_HANDLE = __val$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static int __val(MemorySegment struct, long index0) { + return (int)__val$ELEM_HANDLE.get(struct, 0L, index0); + } + + /** + * Indexed setter for field: + * {@snippet lang=c : + * int __val[2] + * } + */ + public static void __val(MemorySegment struct, long index0, int fieldValue) { + __val$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); + } + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); + } + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); + } +} diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuOptMIPGetSolutionCallback.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuOptMIPGetSolutionCallback.java new file mode 100644 index 0000000000..abc9ef6e83 --- /dev/null +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuOptMIPGetSolutionCallback.java @@ -0,0 +1,69 @@ +// Generated by jextract + +package com.nvidia.cuopt.internal.panama; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +/** + * {@snippet lang=c : + * typedef void (*cuOptMIPGetSolutionCallback)(const cuopt_float_t *, const cuopt_float_t *, const cuopt_float_t *, void *) + * } + */ +public class cuOptMIPGetSolutionCallback { + + cuOptMIPGetSolutionCallback() { + // Should not be called directly + } + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + void apply(MemorySegment solution, MemorySegment objective_value, MemorySegment solution_bound, MemorySegment user_data); + } + + private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = cuopt_c_h.upcallHandle(cuOptMIPGetSolutionCallback.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(cuOptMIPGetSolutionCallback.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static void invoke(MemorySegment funcPtr,MemorySegment solution, MemorySegment objective_value, MemorySegment solution_bound, MemorySegment user_data) { + try { + DOWN$MH.invokeExact(funcPtr, solution, objective_value, solution_bound, user_data); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuOptMIPSetSolutionCallback.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuOptMIPSetSolutionCallback.java new file mode 100644 index 0000000000..b6168de63c --- /dev/null +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuOptMIPSetSolutionCallback.java @@ -0,0 +1,69 @@ +// Generated by jextract + +package com.nvidia.cuopt.internal.panama; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +/** + * {@snippet lang=c : + * typedef void (*cuOptMIPSetSolutionCallback)(cuopt_float_t *, cuopt_float_t *, const cuopt_float_t *, void *) + * } + */ +public class cuOptMIPSetSolutionCallback { + + cuOptMIPSetSolutionCallback() { + // Should not be called directly + } + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + void apply(MemorySegment solution, MemorySegment objective_value, MemorySegment solution_bound, MemorySegment user_data); + } + + private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = cuopt_c_h.upcallHandle(cuOptMIPSetSolutionCallback.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(cuOptMIPSetSolutionCallback.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static void invoke(MemorySegment funcPtr,MemorySegment solution, MemorySegment objective_value, MemorySegment solution_bound, MemorySegment user_data) { + try { + DOWN$MH.invokeExact(funcPtr, solution, objective_value, solution_bound, user_data); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuopt_c_h.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuopt_c_h.java new file mode 100644 index 0000000000..e5dcffa9ed --- /dev/null +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuopt_c_h.java @@ -0,0 +1,23515 @@ +// Generated by jextract + +package com.nvidia.cuopt.internal.panama; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +public class cuopt_c_h { + + cuopt_c_h() { + // Should not be called directly + } + + static final Arena LIBRARY_ARENA = Arena.ofAuto(); + static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); + + static void traceDowncall(String name, Object... args) { + String traceArgs = Arrays.stream(args) + .map(Object::toString) + .collect(Collectors.joining(", ")); + System.out.printf("%s(%s)\n", name, traceArgs); + } + + static MemorySegment findOrThrow(String symbol) { + return SYMBOL_LOOKUP.find(symbol) + .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); + } + + static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { + try { + return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); + } catch (ReflectiveOperationException ex) { + throw new AssertionError(ex); + } + } + + static MemoryLayout align(MemoryLayout layout, long align) { + return switch (layout) { + case PaddingLayout p -> p; + case ValueLayout v -> v.withByteAlignment(align); + case GroupLayout g -> { + MemoryLayout[] alignedMembers = g.memberLayouts().stream() + .map(m -> align(m, align)).toArray(MemoryLayout[]::new); + yield g instanceof StructLayout ? + MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); + } + case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); + }; + } + + + static { + System.loadLibrary("cuopt"); + } + + static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup() + .or(Linker.nativeLinker().defaultLookup()); + + public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; + public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; + public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; + public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; + public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; + public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; + public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; + public static final AddressLayout C_POINTER = ValueLayout.ADDRESS + .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); + public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG; + private static final int _MATH_H = (int)1L; + /** + * {@snippet lang=c : + * #define _MATH_H 1 + * } + */ + public static int _MATH_H() { + return _MATH_H; + } + private static final int _FEATURES_H = (int)1L; + /** + * {@snippet lang=c : + * #define _FEATURES_H 1 + * } + */ + public static int _FEATURES_H() { + return _FEATURES_H; + } + private static final int _DEFAULT_SOURCE = (int)1L; + /** + * {@snippet lang=c : + * #define _DEFAULT_SOURCE 1 + * } + */ + public static int _DEFAULT_SOURCE() { + return _DEFAULT_SOURCE; + } + private static final int __GLIBC_USE_ISOC2X = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_ISOC2X 0 + * } + */ + public static int __GLIBC_USE_ISOC2X() { + return __GLIBC_USE_ISOC2X; + } + private static final int __USE_ISOC11 = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_ISOC11 1 + * } + */ + public static int __USE_ISOC11() { + return __USE_ISOC11; + } + private static final int __USE_ISOC99 = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_ISOC99 1 + * } + */ + public static int __USE_ISOC99() { + return __USE_ISOC99; + } + private static final int __USE_ISOC95 = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_ISOC95 1 + * } + */ + public static int __USE_ISOC95() { + return __USE_ISOC95; + } + private static final int __USE_POSIX_IMPLICITLY = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_POSIX_IMPLICITLY 1 + * } + */ + public static int __USE_POSIX_IMPLICITLY() { + return __USE_POSIX_IMPLICITLY; + } + private static final int _POSIX_SOURCE = (int)1L; + /** + * {@snippet lang=c : + * #define _POSIX_SOURCE 1 + * } + */ + public static int _POSIX_SOURCE() { + return _POSIX_SOURCE; + } + private static final int __USE_POSIX = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_POSIX 1 + * } + */ + public static int __USE_POSIX() { + return __USE_POSIX; + } + private static final int __USE_POSIX2 = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_POSIX2 1 + * } + */ + public static int __USE_POSIX2() { + return __USE_POSIX2; + } + private static final int __USE_POSIX199309 = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_POSIX199309 1 + * } + */ + public static int __USE_POSIX199309() { + return __USE_POSIX199309; + } + private static final int __USE_POSIX199506 = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_POSIX199506 1 + * } + */ + public static int __USE_POSIX199506() { + return __USE_POSIX199506; + } + private static final int __USE_XOPEN2K = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_XOPEN2K 1 + * } + */ + public static int __USE_XOPEN2K() { + return __USE_XOPEN2K; + } + private static final int __USE_XOPEN2K8 = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_XOPEN2K8 1 + * } + */ + public static int __USE_XOPEN2K8() { + return __USE_XOPEN2K8; + } + private static final int _ATFILE_SOURCE = (int)1L; + /** + * {@snippet lang=c : + * #define _ATFILE_SOURCE 1 + * } + */ + public static int _ATFILE_SOURCE() { + return _ATFILE_SOURCE; + } + private static final int __WORDSIZE = (int)64L; + /** + * {@snippet lang=c : + * #define __WORDSIZE 64 + * } + */ + public static int __WORDSIZE() { + return __WORDSIZE; + } + private static final int __WORDSIZE_TIME64_COMPAT32 = (int)1L; + /** + * {@snippet lang=c : + * #define __WORDSIZE_TIME64_COMPAT32 1 + * } + */ + public static int __WORDSIZE_TIME64_COMPAT32() { + return __WORDSIZE_TIME64_COMPAT32; + } + private static final int __SYSCALL_WORDSIZE = (int)64L; + /** + * {@snippet lang=c : + * #define __SYSCALL_WORDSIZE 64 + * } + */ + public static int __SYSCALL_WORDSIZE() { + return __SYSCALL_WORDSIZE; + } + private static final int __USE_MISC = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_MISC 1 + * } + */ + public static int __USE_MISC() { + return __USE_MISC; + } + private static final int __USE_ATFILE = (int)1L; + /** + * {@snippet lang=c : + * #define __USE_ATFILE 1 + * } + */ + public static int __USE_ATFILE() { + return __USE_ATFILE; + } + private static final int __USE_FORTIFY_LEVEL = (int)0L; + /** + * {@snippet lang=c : + * #define __USE_FORTIFY_LEVEL 0 + * } + */ + public static int __USE_FORTIFY_LEVEL() { + return __USE_FORTIFY_LEVEL; + } + private static final int __GLIBC_USE_DEPRECATED_GETS = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_DEPRECATED_GETS 0 + * } + */ + public static int __GLIBC_USE_DEPRECATED_GETS() { + return __GLIBC_USE_DEPRECATED_GETS; + } + private static final int __GLIBC_USE_DEPRECATED_SCANF = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_DEPRECATED_SCANF 0 + * } + */ + public static int __GLIBC_USE_DEPRECATED_SCANF() { + return __GLIBC_USE_DEPRECATED_SCANF; + } + private static final int _STDC_PREDEF_H = (int)1L; + /** + * {@snippet lang=c : + * #define _STDC_PREDEF_H 1 + * } + */ + public static int _STDC_PREDEF_H() { + return _STDC_PREDEF_H; + } + private static final int __STDC_IEC_559__ = (int)1L; + /** + * {@snippet lang=c : + * #define __STDC_IEC_559__ 1 + * } + */ + public static int __STDC_IEC_559__() { + return __STDC_IEC_559__; + } + private static final int __STDC_IEC_559_COMPLEX__ = (int)1L; + /** + * {@snippet lang=c : + * #define __STDC_IEC_559_COMPLEX__ 1 + * } + */ + public static int __STDC_IEC_559_COMPLEX__() { + return __STDC_IEC_559_COMPLEX__; + } + private static final int __GNU_LIBRARY__ = (int)6L; + /** + * {@snippet lang=c : + * #define __GNU_LIBRARY__ 6 + * } + */ + public static int __GNU_LIBRARY__() { + return __GNU_LIBRARY__; + } + private static final int __GLIBC__ = (int)2L; + /** + * {@snippet lang=c : + * #define __GLIBC__ 2 + * } + */ + public static int __GLIBC__() { + return __GLIBC__; + } + private static final int __GLIBC_MINOR__ = (int)35L; + /** + * {@snippet lang=c : + * #define __GLIBC_MINOR__ 35 + * } + */ + public static int __GLIBC_MINOR__() { + return __GLIBC_MINOR__; + } + private static final int _SYS_CDEFS_H = (int)1L; + /** + * {@snippet lang=c : + * #define _SYS_CDEFS_H 1 + * } + */ + public static int _SYS_CDEFS_H() { + return _SYS_CDEFS_H; + } + private static final int __glibc_c99_flexarr_available = (int)1L; + /** + * {@snippet lang=c : + * #define __glibc_c99_flexarr_available 1 + * } + */ + public static int __glibc_c99_flexarr_available() { + return __glibc_c99_flexarr_available; + } + private static final int __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI = (int)0L; + /** + * {@snippet lang=c : + * #define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 + * } + */ + public static int __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI() { + return __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI; + } + private static final int __HAVE_GENERIC_SELECTION = (int)1L; + /** + * {@snippet lang=c : + * #define __HAVE_GENERIC_SELECTION 1 + * } + */ + public static int __HAVE_GENERIC_SELECTION() { + return __HAVE_GENERIC_SELECTION; + } + private static final int __GLIBC_USE_LIB_EXT2 = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_LIB_EXT2 0 + * } + */ + public static int __GLIBC_USE_LIB_EXT2() { + return __GLIBC_USE_LIB_EXT2; + } + private static final int __GLIBC_USE_IEC_60559_BFP_EXT = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_IEC_60559_BFP_EXT 0 + * } + */ + public static int __GLIBC_USE_IEC_60559_BFP_EXT() { + return __GLIBC_USE_IEC_60559_BFP_EXT; + } + private static final int __GLIBC_USE_IEC_60559_BFP_EXT_C2X = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0 + * } + */ + public static int __GLIBC_USE_IEC_60559_BFP_EXT_C2X() { + return __GLIBC_USE_IEC_60559_BFP_EXT_C2X; + } + private static final int __GLIBC_USE_IEC_60559_EXT = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_IEC_60559_EXT 0 + * } + */ + public static int __GLIBC_USE_IEC_60559_EXT() { + return __GLIBC_USE_IEC_60559_EXT; + } + private static final int __GLIBC_USE_IEC_60559_FUNCS_EXT = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_IEC_60559_FUNCS_EXT 0 + * } + */ + public static int __GLIBC_USE_IEC_60559_FUNCS_EXT() { + return __GLIBC_USE_IEC_60559_FUNCS_EXT; + } + private static final int __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 0 + * } + */ + public static int __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X() { + return __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X; + } + private static final int __GLIBC_USE_IEC_60559_TYPES_EXT = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_USE_IEC_60559_TYPES_EXT 0 + * } + */ + public static int __GLIBC_USE_IEC_60559_TYPES_EXT() { + return __GLIBC_USE_IEC_60559_TYPES_EXT; + } + private static final int _BITS_TYPES_H = (int)1L; + /** + * {@snippet lang=c : + * #define _BITS_TYPES_H 1 + * } + */ + public static int _BITS_TYPES_H() { + return _BITS_TYPES_H; + } + private static final int _BITS_TYPESIZES_H = (int)1L; + /** + * {@snippet lang=c : + * #define _BITS_TYPESIZES_H 1 + * } + */ + public static int _BITS_TYPESIZES_H() { + return _BITS_TYPESIZES_H; + } + private static final int __OFF_T_MATCHES_OFF64_T = (int)1L; + /** + * {@snippet lang=c : + * #define __OFF_T_MATCHES_OFF64_T 1 + * } + */ + public static int __OFF_T_MATCHES_OFF64_T() { + return __OFF_T_MATCHES_OFF64_T; + } + private static final int __INO_T_MATCHES_INO64_T = (int)1L; + /** + * {@snippet lang=c : + * #define __INO_T_MATCHES_INO64_T 1 + * } + */ + public static int __INO_T_MATCHES_INO64_T() { + return __INO_T_MATCHES_INO64_T; + } + private static final int __RLIM_T_MATCHES_RLIM64_T = (int)1L; + /** + * {@snippet lang=c : + * #define __RLIM_T_MATCHES_RLIM64_T 1 + * } + */ + public static int __RLIM_T_MATCHES_RLIM64_T() { + return __RLIM_T_MATCHES_RLIM64_T; + } + private static final int __STATFS_MATCHES_STATFS64 = (int)1L; + /** + * {@snippet lang=c : + * #define __STATFS_MATCHES_STATFS64 1 + * } + */ + public static int __STATFS_MATCHES_STATFS64() { + return __STATFS_MATCHES_STATFS64; + } + private static final int __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 = (int)1L; + /** + * {@snippet lang=c : + * #define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 + * } + */ + public static int __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64() { + return __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64; + } + private static final int __FD_SETSIZE = (int)1024L; + /** + * {@snippet lang=c : + * #define __FD_SETSIZE 1024 + * } + */ + public static int __FD_SETSIZE() { + return __FD_SETSIZE; + } + private static final int _BITS_TIME64_H = (int)1L; + /** + * {@snippet lang=c : + * #define _BITS_TIME64_H 1 + * } + */ + public static int _BITS_TIME64_H() { + return _BITS_TIME64_H; + } + private static final int _BITS_LIBM_SIMD_DECL_STUBS_H = (int)1L; + /** + * {@snippet lang=c : + * #define _BITS_LIBM_SIMD_DECL_STUBS_H 1 + * } + */ + public static int _BITS_LIBM_SIMD_DECL_STUBS_H() { + return _BITS_LIBM_SIMD_DECL_STUBS_H; + } + private static final int __HAVE_FLOAT128 = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT128 0 + * } + */ + public static int __HAVE_FLOAT128() { + return __HAVE_FLOAT128; + } + private static final int __HAVE_DISTINCT_FLOAT128 = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_DISTINCT_FLOAT128 0 + * } + */ + public static int __HAVE_DISTINCT_FLOAT128() { + return __HAVE_DISTINCT_FLOAT128; + } + private static final int __HAVE_FLOAT64X = (int)1L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT64X 1 + * } + */ + public static int __HAVE_FLOAT64X() { + return __HAVE_FLOAT64X; + } + private static final int __HAVE_FLOAT64X_LONG_DOUBLE = (int)1L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT64X_LONG_DOUBLE 1 + * } + */ + public static int __HAVE_FLOAT64X_LONG_DOUBLE() { + return __HAVE_FLOAT64X_LONG_DOUBLE; + } + private static final int __HAVE_FLOAT16 = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT16 0 + * } + */ + public static int __HAVE_FLOAT16() { + return __HAVE_FLOAT16; + } + private static final int __HAVE_FLOAT32 = (int)1L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT32 1 + * } + */ + public static int __HAVE_FLOAT32() { + return __HAVE_FLOAT32; + } + private static final int __HAVE_FLOAT64 = (int)1L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT64 1 + * } + */ + public static int __HAVE_FLOAT64() { + return __HAVE_FLOAT64; + } + private static final int __HAVE_FLOAT32X = (int)1L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT32X 1 + * } + */ + public static int __HAVE_FLOAT32X() { + return __HAVE_FLOAT32X; + } + private static final int __HAVE_FLOAT128X = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT128X 0 + * } + */ + public static int __HAVE_FLOAT128X() { + return __HAVE_FLOAT128X; + } + private static final int __HAVE_DISTINCT_FLOAT32 = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_DISTINCT_FLOAT32 0 + * } + */ + public static int __HAVE_DISTINCT_FLOAT32() { + return __HAVE_DISTINCT_FLOAT32; + } + private static final int __HAVE_DISTINCT_FLOAT64 = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_DISTINCT_FLOAT64 0 + * } + */ + public static int __HAVE_DISTINCT_FLOAT64() { + return __HAVE_DISTINCT_FLOAT64; + } + private static final int __HAVE_DISTINCT_FLOAT32X = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_DISTINCT_FLOAT32X 0 + * } + */ + public static int __HAVE_DISTINCT_FLOAT32X() { + return __HAVE_DISTINCT_FLOAT32X; + } + private static final int __HAVE_DISTINCT_FLOAT64X = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_DISTINCT_FLOAT64X 0 + * } + */ + public static int __HAVE_DISTINCT_FLOAT64X() { + return __HAVE_DISTINCT_FLOAT64X; + } + private static final int __HAVE_FLOATN_NOT_TYPEDEF = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOATN_NOT_TYPEDEF 0 + * } + */ + public static int __HAVE_FLOATN_NOT_TYPEDEF() { + return __HAVE_FLOATN_NOT_TYPEDEF; + } + private static final int __FP_LOGB0_IS_MIN = (int)1L; + /** + * {@snippet lang=c : + * #define __FP_LOGB0_IS_MIN 1 + * } + */ + public static int __FP_LOGB0_IS_MIN() { + return __FP_LOGB0_IS_MIN; + } + private static final int __FP_LOGBNAN_IS_MIN = (int)1L; + /** + * {@snippet lang=c : + * #define __FP_LOGBNAN_IS_MIN 1 + * } + */ + public static int __FP_LOGBNAN_IS_MIN() { + return __FP_LOGBNAN_IS_MIN; + } + private static final int __MATH_DECLARING_DOUBLE = (int)1L; + /** + * {@snippet lang=c : + * #define __MATH_DECLARING_DOUBLE 1 + * } + */ + public static int __MATH_DECLARING_DOUBLE() { + return __MATH_DECLARING_DOUBLE; + } + private static final int __MATH_DECLARING_FLOATN = (int)0L; + /** + * {@snippet lang=c : + * #define __MATH_DECLARING_FLOATN 0 + * } + */ + public static int __MATH_DECLARING_FLOATN() { + return __MATH_DECLARING_FLOATN; + } + private static final int __MATH_DECLARE_LDOUBLE = (int)1L; + /** + * {@snippet lang=c : + * #define __MATH_DECLARE_LDOUBLE 1 + * } + */ + public static int __MATH_DECLARE_LDOUBLE() { + return __MATH_DECLARE_LDOUBLE; + } + private static final int FP_NAN = (int)0L; + /** + * {@snippet lang=c : + * #define FP_NAN 0 + * } + */ + public static int FP_NAN() { + return FP_NAN; + } + private static final int FP_INFINITE = (int)1L; + /** + * {@snippet lang=c : + * #define FP_INFINITE 1 + * } + */ + public static int FP_INFINITE() { + return FP_INFINITE; + } + private static final int FP_ZERO = (int)2L; + /** + * {@snippet lang=c : + * #define FP_ZERO 2 + * } + */ + public static int FP_ZERO() { + return FP_ZERO; + } + private static final int FP_SUBNORMAL = (int)3L; + /** + * {@snippet lang=c : + * #define FP_SUBNORMAL 3 + * } + */ + public static int FP_SUBNORMAL() { + return FP_SUBNORMAL; + } + private static final int FP_NORMAL = (int)4L; + /** + * {@snippet lang=c : + * #define FP_NORMAL 4 + * } + */ + public static int FP_NORMAL() { + return FP_NORMAL; + } + private static final int MATH_ERRNO = (int)1L; + /** + * {@snippet lang=c : + * #define MATH_ERRNO 1 + * } + */ + public static int MATH_ERRNO() { + return MATH_ERRNO; + } + private static final int MATH_ERREXCEPT = (int)2L; + /** + * {@snippet lang=c : + * #define MATH_ERREXCEPT 2 + * } + */ + public static int MATH_ERREXCEPT() { + return MATH_ERREXCEPT; + } + private static final int CUOPT_INSTANTIATE_FLOAT = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_INSTANTIATE_FLOAT 0 + * } + */ + public static int CUOPT_INSTANTIATE_FLOAT() { + return CUOPT_INSTANTIATE_FLOAT; + } + private static final int CUOPT_INSTANTIATE_DOUBLE = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_INSTANTIATE_DOUBLE 1 + * } + */ + public static int CUOPT_INSTANTIATE_DOUBLE() { + return CUOPT_INSTANTIATE_DOUBLE; + } + private static final int CUOPT_INSTANTIATE_INT32 = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_INSTANTIATE_INT32 1 + * } + */ + public static int CUOPT_INSTANTIATE_INT32() { + return CUOPT_INSTANTIATE_INT32; + } + private static final int CUOPT_INSTANTIATE_INT64 = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_INSTANTIATE_INT64 0 + * } + */ + public static int CUOPT_INSTANTIATE_INT64() { + return CUOPT_INSTANTIATE_INT64; + } + private static final int CUOPT_MODE_OPPORTUNISTIC = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_MODE_OPPORTUNISTIC 0 + * } + */ + public static int CUOPT_MODE_OPPORTUNISTIC() { + return CUOPT_MODE_OPPORTUNISTIC; + } + private static final int CUOPT_MODE_DETERMINISTIC = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_MODE_DETERMINISTIC 1 + * } + */ + public static int CUOPT_MODE_DETERMINISTIC() { + return CUOPT_MODE_DETERMINISTIC; + } + private static final int CUOPT_TERMINATION_STATUS_NO_TERMINATION = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_NO_TERMINATION 0 + * } + */ + public static int CUOPT_TERMINATION_STATUS_NO_TERMINATION() { + return CUOPT_TERMINATION_STATUS_NO_TERMINATION; + } + private static final int CUOPT_TERMINATION_STATUS_OPTIMAL = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_OPTIMAL 1 + * } + */ + public static int CUOPT_TERMINATION_STATUS_OPTIMAL() { + return CUOPT_TERMINATION_STATUS_OPTIMAL; + } + private static final int CUOPT_TERMINATION_STATUS_INFEASIBLE = (int)2L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_INFEASIBLE 2 + * } + */ + public static int CUOPT_TERMINATION_STATUS_INFEASIBLE() { + return CUOPT_TERMINATION_STATUS_INFEASIBLE; + } + private static final int CUOPT_TERMINATION_STATUS_UNBOUNDED = (int)3L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_UNBOUNDED 3 + * } + */ + public static int CUOPT_TERMINATION_STATUS_UNBOUNDED() { + return CUOPT_TERMINATION_STATUS_UNBOUNDED; + } + private static final int CUOPT_TERMINATION_STATUS_ITERATION_LIMIT = (int)4L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_ITERATION_LIMIT 4 + * } + */ + public static int CUOPT_TERMINATION_STATUS_ITERATION_LIMIT() { + return CUOPT_TERMINATION_STATUS_ITERATION_LIMIT; + } + private static final int CUOPT_TERMINATION_STATUS_TIME_LIMIT = (int)5L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_TIME_LIMIT 5 + * } + */ + public static int CUOPT_TERMINATION_STATUS_TIME_LIMIT() { + return CUOPT_TERMINATION_STATUS_TIME_LIMIT; + } + private static final int CUOPT_TERMINATION_STATUS_NUMERICAL_ERROR = (int)6L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_NUMERICAL_ERROR 6 + * } + */ + public static int CUOPT_TERMINATION_STATUS_NUMERICAL_ERROR() { + return CUOPT_TERMINATION_STATUS_NUMERICAL_ERROR; + } + private static final int CUOPT_TERMINATION_STATUS_PRIMAL_FEASIBLE = (int)7L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_PRIMAL_FEASIBLE 7 + * } + */ + public static int CUOPT_TERMINATION_STATUS_PRIMAL_FEASIBLE() { + return CUOPT_TERMINATION_STATUS_PRIMAL_FEASIBLE; + } + private static final int CUOPT_TERMINATION_STATUS_FEASIBLE_FOUND = (int)8L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_FEASIBLE_FOUND 8 + * } + */ + public static int CUOPT_TERMINATION_STATUS_FEASIBLE_FOUND() { + return CUOPT_TERMINATION_STATUS_FEASIBLE_FOUND; + } + private static final int CUOPT_TERMINATION_STATUS_CONCURRENT_LIMIT = (int)9L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_CONCURRENT_LIMIT 9 + * } + */ + public static int CUOPT_TERMINATION_STATUS_CONCURRENT_LIMIT() { + return CUOPT_TERMINATION_STATUS_CONCURRENT_LIMIT; + } + private static final int CUOPT_TERMINATION_STATUS_WORK_LIMIT = (int)10L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_WORK_LIMIT 10 + * } + */ + public static int CUOPT_TERMINATION_STATUS_WORK_LIMIT() { + return CUOPT_TERMINATION_STATUS_WORK_LIMIT; + } + private static final int CUOPT_TERMINATION_STATUS_UNBOUNDED_OR_INFEASIBLE = (int)11L; + /** + * {@snippet lang=c : + * #define CUOPT_TERMINATION_STATUS_UNBOUNDED_OR_INFEASIBLE 11 + * } + */ + public static int CUOPT_TERMINATION_STATUS_UNBOUNDED_OR_INFEASIBLE() { + return CUOPT_TERMINATION_STATUS_UNBOUNDED_OR_INFEASIBLE; + } + private static final int CUOPT_MINIMIZE = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_MINIMIZE 1 + * } + */ + public static int CUOPT_MINIMIZE() { + return CUOPT_MINIMIZE; + } + private static final int CUOPT_PDLP_SOLVER_MODE_STABLE1 = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_SOLVER_MODE_STABLE1 0 + * } + */ + public static int CUOPT_PDLP_SOLVER_MODE_STABLE1() { + return CUOPT_PDLP_SOLVER_MODE_STABLE1; + } + private static final int CUOPT_PDLP_SOLVER_MODE_STABLE2 = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_SOLVER_MODE_STABLE2 1 + * } + */ + public static int CUOPT_PDLP_SOLVER_MODE_STABLE2() { + return CUOPT_PDLP_SOLVER_MODE_STABLE2; + } + private static final int CUOPT_PDLP_SOLVER_MODE_METHODICAL1 = (int)2L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_SOLVER_MODE_METHODICAL1 2 + * } + */ + public static int CUOPT_PDLP_SOLVER_MODE_METHODICAL1() { + return CUOPT_PDLP_SOLVER_MODE_METHODICAL1; + } + private static final int CUOPT_PDLP_SOLVER_MODE_FAST1 = (int)3L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_SOLVER_MODE_FAST1 3 + * } + */ + public static int CUOPT_PDLP_SOLVER_MODE_FAST1() { + return CUOPT_PDLP_SOLVER_MODE_FAST1; + } + private static final int CUOPT_PDLP_SOLVER_MODE_STABLE3 = (int)4L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_SOLVER_MODE_STABLE3 4 + * } + */ + public static int CUOPT_PDLP_SOLVER_MODE_STABLE3() { + return CUOPT_PDLP_SOLVER_MODE_STABLE3; + } + private static final int CUOPT_METHOD_CONCURRENT = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_METHOD_CONCURRENT 0 + * } + */ + public static int CUOPT_METHOD_CONCURRENT() { + return CUOPT_METHOD_CONCURRENT; + } + private static final int CUOPT_METHOD_PDLP = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_METHOD_PDLP 1 + * } + */ + public static int CUOPT_METHOD_PDLP() { + return CUOPT_METHOD_PDLP; + } + private static final int CUOPT_METHOD_DUAL_SIMPLEX = (int)2L; + /** + * {@snippet lang=c : + * #define CUOPT_METHOD_DUAL_SIMPLEX 2 + * } + */ + public static int CUOPT_METHOD_DUAL_SIMPLEX() { + return CUOPT_METHOD_DUAL_SIMPLEX; + } + private static final int CUOPT_METHOD_BARRIER = (int)3L; + /** + * {@snippet lang=c : + * #define CUOPT_METHOD_BARRIER 3 + * } + */ + public static int CUOPT_METHOD_BARRIER() { + return CUOPT_METHOD_BARRIER; + } + private static final int CUOPT_METHOD_UNSET = (int)4L; + /** + * {@snippet lang=c : + * #define CUOPT_METHOD_UNSET 4 + * } + */ + public static int CUOPT_METHOD_UNSET() { + return CUOPT_METHOD_UNSET; + } + private static final int CUOPT_PDLP_SINGLE_PRECISION = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_SINGLE_PRECISION 0 + * } + */ + public static int CUOPT_PDLP_SINGLE_PRECISION() { + return CUOPT_PDLP_SINGLE_PRECISION; + } + private static final int CUOPT_PDLP_DOUBLE_PRECISION = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_DOUBLE_PRECISION 1 + * } + */ + public static int CUOPT_PDLP_DOUBLE_PRECISION() { + return CUOPT_PDLP_DOUBLE_PRECISION; + } + private static final int CUOPT_PDLP_MIXED_PRECISION = (int)2L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_MIXED_PRECISION 2 + * } + */ + public static int CUOPT_PDLP_MIXED_PRECISION() { + return CUOPT_PDLP_MIXED_PRECISION; + } + private static final int CUOPT_FILE_FORMAT_MPS = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_FILE_FORMAT_MPS 0 + * } + */ + public static int CUOPT_FILE_FORMAT_MPS() { + return CUOPT_FILE_FORMAT_MPS; + } + private static final int CUOPT_SUCCESS = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_SUCCESS 0 + * } + */ + public static int CUOPT_SUCCESS() { + return CUOPT_SUCCESS; + } + private static final int CUOPT_INVALID_ARGUMENT = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_INVALID_ARGUMENT 1 + * } + */ + public static int CUOPT_INVALID_ARGUMENT() { + return CUOPT_INVALID_ARGUMENT; + } + private static final int CUOPT_MPS_FILE_ERROR = (int)2L; + /** + * {@snippet lang=c : + * #define CUOPT_MPS_FILE_ERROR 2 + * } + */ + public static int CUOPT_MPS_FILE_ERROR() { + return CUOPT_MPS_FILE_ERROR; + } + private static final int CUOPT_MPS_PARSE_ERROR = (int)3L; + /** + * {@snippet lang=c : + * #define CUOPT_MPS_PARSE_ERROR 3 + * } + */ + public static int CUOPT_MPS_PARSE_ERROR() { + return CUOPT_MPS_PARSE_ERROR; + } + private static final int CUOPT_VALIDATION_ERROR = (int)4L; + /** + * {@snippet lang=c : + * #define CUOPT_VALIDATION_ERROR 4 + * } + */ + public static int CUOPT_VALIDATION_ERROR() { + return CUOPT_VALIDATION_ERROR; + } + private static final int CUOPT_OUT_OF_MEMORY = (int)5L; + /** + * {@snippet lang=c : + * #define CUOPT_OUT_OF_MEMORY 5 + * } + */ + public static int CUOPT_OUT_OF_MEMORY() { + return CUOPT_OUT_OF_MEMORY; + } + private static final int CUOPT_RUNTIME_ERROR = (int)6L; + /** + * {@snippet lang=c : + * #define CUOPT_RUNTIME_ERROR 6 + * } + */ + public static int CUOPT_RUNTIME_ERROR() { + return CUOPT_RUNTIME_ERROR; + } + private static final int CUOPT_PRESOLVE_OFF = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_PRESOLVE_OFF 0 + * } + */ + public static int CUOPT_PRESOLVE_OFF() { + return CUOPT_PRESOLVE_OFF; + } + private static final int CUOPT_PRESOLVE_PAPILO = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_PRESOLVE_PAPILO 1 + * } + */ + public static int CUOPT_PRESOLVE_PAPILO() { + return CUOPT_PRESOLVE_PAPILO; + } + private static final int CUOPT_PRESOLVE_PSLP = (int)2L; + /** + * {@snippet lang=c : + * #define CUOPT_PRESOLVE_PSLP 2 + * } + */ + public static int CUOPT_PRESOLVE_PSLP() { + return CUOPT_PRESOLVE_PSLP; + } + private static final int CUOPT_MIP_SCALING_OFF = (int)0L; + /** + * {@snippet lang=c : + * #define CUOPT_MIP_SCALING_OFF 0 + * } + */ + public static int CUOPT_MIP_SCALING_OFF() { + return CUOPT_MIP_SCALING_OFF; + } + private static final int CUOPT_MIP_SCALING_ON = (int)1L; + /** + * {@snippet lang=c : + * #define CUOPT_MIP_SCALING_ON 1 + * } + */ + public static int CUOPT_MIP_SCALING_ON() { + return CUOPT_MIP_SCALING_ON; + } + private static final int CUOPT_MIP_SCALING_NO_OBJECTIVE = (int)2L; + /** + * {@snippet lang=c : + * #define CUOPT_MIP_SCALING_NO_OBJECTIVE 2 + * } + */ + public static int CUOPT_MIP_SCALING_NO_OBJECTIVE() { + return CUOPT_MIP_SCALING_NO_OBJECTIVE; + } + private static final int _STDINT_H = (int)1L; + /** + * {@snippet lang=c : + * #define _STDINT_H 1 + * } + */ + public static int _STDINT_H() { + return _STDINT_H; + } + private static final int _BITS_WCHAR_H = (int)1L; + /** + * {@snippet lang=c : + * #define _BITS_WCHAR_H 1 + * } + */ + public static int _BITS_WCHAR_H() { + return _BITS_WCHAR_H; + } + private static final int _BITS_STDINT_INTN_H = (int)1L; + /** + * {@snippet lang=c : + * #define _BITS_STDINT_INTN_H 1 + * } + */ + public static int _BITS_STDINT_INTN_H() { + return _BITS_STDINT_INTN_H; + } + private static final int _BITS_STDINT_UINTN_H = (int)1L; + /** + * {@snippet lang=c : + * #define _BITS_STDINT_UINTN_H 1 + * } + */ + public static int _BITS_STDINT_UINTN_H() { + return _BITS_STDINT_UINTN_H; + } + /** + * {@snippet lang=c : + * typedef unsigned char __u_char + * } + */ + public static final OfByte __u_char = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef unsigned short __u_short + * } + */ + public static final OfShort __u_short = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef unsigned int __u_int + * } + */ + public static final OfInt __u_int = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef unsigned long __u_long + * } + */ + public static final OfLong __u_long = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef signed char __int8_t + * } + */ + public static final OfByte __int8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef unsigned char __uint8_t + * } + */ + public static final OfByte __uint8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef short __int16_t + * } + */ + public static final OfShort __int16_t = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef unsigned short __uint16_t + * } + */ + public static final OfShort __uint16_t = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef int __int32_t + * } + */ + public static final OfInt __int32_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef unsigned int __uint32_t + * } + */ + public static final OfInt __uint32_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef long __int64_t + * } + */ + public static final OfLong __int64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __uint64_t + * } + */ + public static final OfLong __uint64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef __int8_t __int_least8_t + * } + */ + public static final OfByte __int_least8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef __uint8_t __uint_least8_t + * } + */ + public static final OfByte __uint_least8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef __int16_t __int_least16_t + * } + */ + public static final OfShort __int_least16_t = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef __uint16_t __uint_least16_t + * } + */ + public static final OfShort __uint_least16_t = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef __int32_t __int_least32_t + * } + */ + public static final OfInt __int_least32_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef __uint32_t __uint_least32_t + * } + */ + public static final OfInt __uint_least32_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef __int64_t __int_least64_t + * } + */ + public static final OfLong __int_least64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef __uint64_t __uint_least64_t + * } + */ + public static final OfLong __uint_least64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __quad_t + * } + */ + public static final OfLong __quad_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __u_quad_t + * } + */ + public static final OfLong __u_quad_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __intmax_t + * } + */ + public static final OfLong __intmax_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __uintmax_t + * } + */ + public static final OfLong __uintmax_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __dev_t + * } + */ + public static final OfLong __dev_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned int __uid_t + * } + */ + public static final OfInt __uid_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef unsigned int __gid_t + * } + */ + public static final OfInt __gid_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef unsigned long __ino_t + * } + */ + public static final OfLong __ino_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __ino64_t + * } + */ + public static final OfLong __ino64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned int __mode_t + * } + */ + public static final OfInt __mode_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef unsigned long __nlink_t + * } + */ + public static final OfLong __nlink_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __off_t + * } + */ + public static final OfLong __off_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __off64_t + * } + */ + public static final OfLong __off64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef int __pid_t + * } + */ + public static final OfInt __pid_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef long __clock_t + * } + */ + public static final OfLong __clock_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __rlim_t + * } + */ + public static final OfLong __rlim_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __rlim64_t + * } + */ + public static final OfLong __rlim64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned int __id_t + * } + */ + public static final OfInt __id_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef long __time_t + * } + */ + public static final OfLong __time_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned int __useconds_t + * } + */ + public static final OfInt __useconds_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef long __suseconds_t + * } + */ + public static final OfLong __suseconds_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __suseconds64_t + * } + */ + public static final OfLong __suseconds64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef int __daddr_t + * } + */ + public static final OfInt __daddr_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef int __key_t + * } + */ + public static final OfInt __key_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef int __clockid_t + * } + */ + public static final OfInt __clockid_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef void *__timer_t + * } + */ + public static final AddressLayout __timer_t = cuopt_c_h.C_POINTER; + /** + * {@snippet lang=c : + * typedef long __blksize_t + * } + */ + public static final OfLong __blksize_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __blkcnt_t + * } + */ + public static final OfLong __blkcnt_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __blkcnt64_t + * } + */ + public static final OfLong __blkcnt64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __fsblkcnt_t + * } + */ + public static final OfLong __fsblkcnt_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __fsblkcnt64_t + * } + */ + public static final OfLong __fsblkcnt64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __fsfilcnt_t + * } + */ + public static final OfLong __fsfilcnt_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __fsfilcnt64_t + * } + */ + public static final OfLong __fsfilcnt64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __fsword_t + * } + */ + public static final OfLong __fsword_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __ssize_t + * } + */ + public static final OfLong __ssize_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long __syscall_slong_t + * } + */ + public static final OfLong __syscall_slong_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long __syscall_ulong_t + * } + */ + public static final OfLong __syscall_ulong_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef __off64_t __loff_t + * } + */ + public static final OfLong __loff_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef char *__caddr_t + * } + */ + public static final AddressLayout __caddr_t = cuopt_c_h.C_POINTER; + /** + * {@snippet lang=c : + * typedef long __intptr_t + * } + */ + public static final OfLong __intptr_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned int __socklen_t + * } + */ + public static final OfInt __socklen_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef int __sig_atomic_t + * } + */ + public static final OfInt __sig_atomic_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef float _Float32 + * } + */ + public static final OfFloat _Float32 = cuopt_c_h.C_FLOAT; + /** + * {@snippet lang=c : + * typedef double _Float64 + * } + */ + public static final OfDouble _Float64 = cuopt_c_h.C_DOUBLE; + /** + * {@snippet lang=c : + * typedef double _Float32x + * } + */ + public static final OfDouble _Float32x = cuopt_c_h.C_DOUBLE; + /** + * {@snippet lang=c : + * typedef float float_t + * } + */ + public static final OfFloat float_t = cuopt_c_h.C_FLOAT; + /** + * {@snippet lang=c : + * typedef double double_t + * } + */ + public static final OfDouble double_t = cuopt_c_h.C_DOUBLE; + + private static class __fpclassify { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fpclassify"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __fpclassify(double __value) + * } + */ + public static FunctionDescriptor __fpclassify$descriptor() { + return __fpclassify.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __fpclassify(double __value) + * } + */ + public static MethodHandle __fpclassify$handle() { + return __fpclassify.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __fpclassify(double __value) + * } + */ + public static MemorySegment __fpclassify$address() { + return __fpclassify.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __fpclassify(double __value) + * } + */ + public static int __fpclassify(double __value) { + var mh$ = __fpclassify.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fpclassify", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __signbit { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__signbit"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __signbit(double __value) + * } + */ + public static FunctionDescriptor __signbit$descriptor() { + return __signbit.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __signbit(double __value) + * } + */ + public static MethodHandle __signbit$handle() { + return __signbit.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __signbit(double __value) + * } + */ + public static MemorySegment __signbit$address() { + return __signbit.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __signbit(double __value) + * } + */ + public static int __signbit(double __value) { + var mh$ = __signbit.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__signbit", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __isinf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__isinf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __isinf(double __value) + * } + */ + public static FunctionDescriptor __isinf$descriptor() { + return __isinf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __isinf(double __value) + * } + */ + public static MethodHandle __isinf$handle() { + return __isinf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __isinf(double __value) + * } + */ + public static MemorySegment __isinf$address() { + return __isinf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __isinf(double __value) + * } + */ + public static int __isinf(double __value) { + var mh$ = __isinf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__isinf", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __finite { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__finite"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __finite(double __value) + * } + */ + public static FunctionDescriptor __finite$descriptor() { + return __finite.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __finite(double __value) + * } + */ + public static MethodHandle __finite$handle() { + return __finite.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __finite(double __value) + * } + */ + public static MemorySegment __finite$address() { + return __finite.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __finite(double __value) + * } + */ + public static int __finite(double __value) { + var mh$ = __finite.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__finite", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __isnan { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__isnan"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __isnan(double __value) + * } + */ + public static FunctionDescriptor __isnan$descriptor() { + return __isnan.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __isnan(double __value) + * } + */ + public static MethodHandle __isnan$handle() { + return __isnan.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __isnan(double __value) + * } + */ + public static MemorySegment __isnan$address() { + return __isnan.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __isnan(double __value) + * } + */ + public static int __isnan(double __value) { + var mh$ = __isnan.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__isnan", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __iseqsig { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__iseqsig"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __iseqsig(double __x, double __y) + * } + */ + public static FunctionDescriptor __iseqsig$descriptor() { + return __iseqsig.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __iseqsig(double __x, double __y) + * } + */ + public static MethodHandle __iseqsig$handle() { + return __iseqsig.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __iseqsig(double __x, double __y) + * } + */ + public static MemorySegment __iseqsig$address() { + return __iseqsig.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __iseqsig(double __x, double __y) + * } + */ + public static int __iseqsig(double __x, double __y) { + var mh$ = __iseqsig.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__iseqsig", __x, __y); + } + return (int)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __issignaling { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__issignaling"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __issignaling(double __value) + * } + */ + public static FunctionDescriptor __issignaling$descriptor() { + return __issignaling.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __issignaling(double __value) + * } + */ + public static MethodHandle __issignaling$handle() { + return __issignaling.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __issignaling(double __value) + * } + */ + public static MemorySegment __issignaling$address() { + return __issignaling.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __issignaling(double __value) + * } + */ + public static int __issignaling(double __value) { + var mh$ = __issignaling.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__issignaling", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class acos { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("acos"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double acos(double __x) + * } + */ + public static FunctionDescriptor acos$descriptor() { + return acos.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double acos(double __x) + * } + */ + public static MethodHandle acos$handle() { + return acos.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double acos(double __x) + * } + */ + public static MemorySegment acos$address() { + return acos.ADDR; + } + + /** + * {@snippet lang=c : + * extern double acos(double __x) + * } + */ + public static double acos(double __x) { + var mh$ = acos.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("acos", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __acos { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__acos"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __acos(double __x) + * } + */ + public static FunctionDescriptor __acos$descriptor() { + return __acos.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __acos(double __x) + * } + */ + public static MethodHandle __acos$handle() { + return __acos.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __acos(double __x) + * } + */ + public static MemorySegment __acos$address() { + return __acos.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __acos(double __x) + * } + */ + public static double __acos(double __x) { + var mh$ = __acos.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__acos", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class asin { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("asin"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double asin(double __x) + * } + */ + public static FunctionDescriptor asin$descriptor() { + return asin.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double asin(double __x) + * } + */ + public static MethodHandle asin$handle() { + return asin.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double asin(double __x) + * } + */ + public static MemorySegment asin$address() { + return asin.ADDR; + } + + /** + * {@snippet lang=c : + * extern double asin(double __x) + * } + */ + public static double asin(double __x) { + var mh$ = asin.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("asin", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __asin { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__asin"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __asin(double __x) + * } + */ + public static FunctionDescriptor __asin$descriptor() { + return __asin.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __asin(double __x) + * } + */ + public static MethodHandle __asin$handle() { + return __asin.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __asin(double __x) + * } + */ + public static MemorySegment __asin$address() { + return __asin.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __asin(double __x) + * } + */ + public static double __asin(double __x) { + var mh$ = __asin.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__asin", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class atan { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("atan"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double atan(double __x) + * } + */ + public static FunctionDescriptor atan$descriptor() { + return atan.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double atan(double __x) + * } + */ + public static MethodHandle atan$handle() { + return atan.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double atan(double __x) + * } + */ + public static MemorySegment atan$address() { + return atan.ADDR; + } + + /** + * {@snippet lang=c : + * extern double atan(double __x) + * } + */ + public static double atan(double __x) { + var mh$ = atan.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("atan", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __atan { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__atan"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __atan(double __x) + * } + */ + public static FunctionDescriptor __atan$descriptor() { + return __atan.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __atan(double __x) + * } + */ + public static MethodHandle __atan$handle() { + return __atan.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __atan(double __x) + * } + */ + public static MemorySegment __atan$address() { + return __atan.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __atan(double __x) + * } + */ + public static double __atan(double __x) { + var mh$ = __atan.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__atan", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class atan2 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("atan2"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double atan2(double __y, double __x) + * } + */ + public static FunctionDescriptor atan2$descriptor() { + return atan2.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double atan2(double __y, double __x) + * } + */ + public static MethodHandle atan2$handle() { + return atan2.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double atan2(double __y, double __x) + * } + */ + public static MemorySegment atan2$address() { + return atan2.ADDR; + } + + /** + * {@snippet lang=c : + * extern double atan2(double __y, double __x) + * } + */ + public static double atan2(double __y, double __x) { + var mh$ = atan2.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("atan2", __y, __x); + } + return (double)mh$.invokeExact(__y, __x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __atan2 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__atan2"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __atan2(double __y, double __x) + * } + */ + public static FunctionDescriptor __atan2$descriptor() { + return __atan2.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __atan2(double __y, double __x) + * } + */ + public static MethodHandle __atan2$handle() { + return __atan2.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __atan2(double __y, double __x) + * } + */ + public static MemorySegment __atan2$address() { + return __atan2.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __atan2(double __y, double __x) + * } + */ + public static double __atan2(double __y, double __x) { + var mh$ = __atan2.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__atan2", __y, __x); + } + return (double)mh$.invokeExact(__y, __x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cos { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cos"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double cos(double __x) + * } + */ + public static FunctionDescriptor cos$descriptor() { + return cos.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double cos(double __x) + * } + */ + public static MethodHandle cos$handle() { + return cos.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double cos(double __x) + * } + */ + public static MemorySegment cos$address() { + return cos.ADDR; + } + + /** + * {@snippet lang=c : + * extern double cos(double __x) + * } + */ + public static double cos(double __x) { + var mh$ = cos.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cos", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __cos { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__cos"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __cos(double __x) + * } + */ + public static FunctionDescriptor __cos$descriptor() { + return __cos.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __cos(double __x) + * } + */ + public static MethodHandle __cos$handle() { + return __cos.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __cos(double __x) + * } + */ + public static MemorySegment __cos$address() { + return __cos.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __cos(double __x) + * } + */ + public static double __cos(double __x) { + var mh$ = __cos.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__cos", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class sin { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("sin"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double sin(double __x) + * } + */ + public static FunctionDescriptor sin$descriptor() { + return sin.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double sin(double __x) + * } + */ + public static MethodHandle sin$handle() { + return sin.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double sin(double __x) + * } + */ + public static MemorySegment sin$address() { + return sin.ADDR; + } + + /** + * {@snippet lang=c : + * extern double sin(double __x) + * } + */ + public static double sin(double __x) { + var mh$ = sin.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("sin", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __sin { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__sin"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __sin(double __x) + * } + */ + public static FunctionDescriptor __sin$descriptor() { + return __sin.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __sin(double __x) + * } + */ + public static MethodHandle __sin$handle() { + return __sin.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __sin(double __x) + * } + */ + public static MemorySegment __sin$address() { + return __sin.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __sin(double __x) + * } + */ + public static double __sin(double __x) { + var mh$ = __sin.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__sin", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class tan { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("tan"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double tan(double __x) + * } + */ + public static FunctionDescriptor tan$descriptor() { + return tan.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double tan(double __x) + * } + */ + public static MethodHandle tan$handle() { + return tan.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double tan(double __x) + * } + */ + public static MemorySegment tan$address() { + return tan.ADDR; + } + + /** + * {@snippet lang=c : + * extern double tan(double __x) + * } + */ + public static double tan(double __x) { + var mh$ = tan.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("tan", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __tan { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__tan"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __tan(double __x) + * } + */ + public static FunctionDescriptor __tan$descriptor() { + return __tan.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __tan(double __x) + * } + */ + public static MethodHandle __tan$handle() { + return __tan.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __tan(double __x) + * } + */ + public static MemorySegment __tan$address() { + return __tan.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __tan(double __x) + * } + */ + public static double __tan(double __x) { + var mh$ = __tan.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__tan", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cosh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cosh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double cosh(double __x) + * } + */ + public static FunctionDescriptor cosh$descriptor() { + return cosh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double cosh(double __x) + * } + */ + public static MethodHandle cosh$handle() { + return cosh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double cosh(double __x) + * } + */ + public static MemorySegment cosh$address() { + return cosh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double cosh(double __x) + * } + */ + public static double cosh(double __x) { + var mh$ = cosh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cosh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __cosh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__cosh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __cosh(double __x) + * } + */ + public static FunctionDescriptor __cosh$descriptor() { + return __cosh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __cosh(double __x) + * } + */ + public static MethodHandle __cosh$handle() { + return __cosh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __cosh(double __x) + * } + */ + public static MemorySegment __cosh$address() { + return __cosh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __cosh(double __x) + * } + */ + public static double __cosh(double __x) { + var mh$ = __cosh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__cosh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class sinh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("sinh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double sinh(double __x) + * } + */ + public static FunctionDescriptor sinh$descriptor() { + return sinh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double sinh(double __x) + * } + */ + public static MethodHandle sinh$handle() { + return sinh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double sinh(double __x) + * } + */ + public static MemorySegment sinh$address() { + return sinh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double sinh(double __x) + * } + */ + public static double sinh(double __x) { + var mh$ = sinh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("sinh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __sinh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__sinh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __sinh(double __x) + * } + */ + public static FunctionDescriptor __sinh$descriptor() { + return __sinh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __sinh(double __x) + * } + */ + public static MethodHandle __sinh$handle() { + return __sinh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __sinh(double __x) + * } + */ + public static MemorySegment __sinh$address() { + return __sinh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __sinh(double __x) + * } + */ + public static double __sinh(double __x) { + var mh$ = __sinh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__sinh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class tanh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("tanh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double tanh(double __x) + * } + */ + public static FunctionDescriptor tanh$descriptor() { + return tanh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double tanh(double __x) + * } + */ + public static MethodHandle tanh$handle() { + return tanh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double tanh(double __x) + * } + */ + public static MemorySegment tanh$address() { + return tanh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double tanh(double __x) + * } + */ + public static double tanh(double __x) { + var mh$ = tanh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("tanh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __tanh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__tanh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __tanh(double __x) + * } + */ + public static FunctionDescriptor __tanh$descriptor() { + return __tanh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __tanh(double __x) + * } + */ + public static MethodHandle __tanh$handle() { + return __tanh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __tanh(double __x) + * } + */ + public static MemorySegment __tanh$address() { + return __tanh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __tanh(double __x) + * } + */ + public static double __tanh(double __x) { + var mh$ = __tanh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__tanh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class acosh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("acosh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double acosh(double __x) + * } + */ + public static FunctionDescriptor acosh$descriptor() { + return acosh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double acosh(double __x) + * } + */ + public static MethodHandle acosh$handle() { + return acosh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double acosh(double __x) + * } + */ + public static MemorySegment acosh$address() { + return acosh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double acosh(double __x) + * } + */ + public static double acosh(double __x) { + var mh$ = acosh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("acosh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __acosh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__acosh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __acosh(double __x) + * } + */ + public static FunctionDescriptor __acosh$descriptor() { + return __acosh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __acosh(double __x) + * } + */ + public static MethodHandle __acosh$handle() { + return __acosh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __acosh(double __x) + * } + */ + public static MemorySegment __acosh$address() { + return __acosh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __acosh(double __x) + * } + */ + public static double __acosh(double __x) { + var mh$ = __acosh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__acosh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class asinh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("asinh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double asinh(double __x) + * } + */ + public static FunctionDescriptor asinh$descriptor() { + return asinh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double asinh(double __x) + * } + */ + public static MethodHandle asinh$handle() { + return asinh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double asinh(double __x) + * } + */ + public static MemorySegment asinh$address() { + return asinh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double asinh(double __x) + * } + */ + public static double asinh(double __x) { + var mh$ = asinh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("asinh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __asinh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__asinh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __asinh(double __x) + * } + */ + public static FunctionDescriptor __asinh$descriptor() { + return __asinh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __asinh(double __x) + * } + */ + public static MethodHandle __asinh$handle() { + return __asinh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __asinh(double __x) + * } + */ + public static MemorySegment __asinh$address() { + return __asinh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __asinh(double __x) + * } + */ + public static double __asinh(double __x) { + var mh$ = __asinh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__asinh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class atanh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("atanh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double atanh(double __x) + * } + */ + public static FunctionDescriptor atanh$descriptor() { + return atanh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double atanh(double __x) + * } + */ + public static MethodHandle atanh$handle() { + return atanh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double atanh(double __x) + * } + */ + public static MemorySegment atanh$address() { + return atanh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double atanh(double __x) + * } + */ + public static double atanh(double __x) { + var mh$ = atanh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("atanh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __atanh { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__atanh"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __atanh(double __x) + * } + */ + public static FunctionDescriptor __atanh$descriptor() { + return __atanh.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __atanh(double __x) + * } + */ + public static MethodHandle __atanh$handle() { + return __atanh.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __atanh(double __x) + * } + */ + public static MemorySegment __atanh$address() { + return __atanh.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __atanh(double __x) + * } + */ + public static double __atanh(double __x) { + var mh$ = __atanh.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__atanh", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class exp { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("exp"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double exp(double __x) + * } + */ + public static FunctionDescriptor exp$descriptor() { + return exp.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double exp(double __x) + * } + */ + public static MethodHandle exp$handle() { + return exp.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double exp(double __x) + * } + */ + public static MemorySegment exp$address() { + return exp.ADDR; + } + + /** + * {@snippet lang=c : + * extern double exp(double __x) + * } + */ + public static double exp(double __x) { + var mh$ = exp.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("exp", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __exp { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__exp"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __exp(double __x) + * } + */ + public static FunctionDescriptor __exp$descriptor() { + return __exp.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __exp(double __x) + * } + */ + public static MethodHandle __exp$handle() { + return __exp.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __exp(double __x) + * } + */ + public static MemorySegment __exp$address() { + return __exp.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __exp(double __x) + * } + */ + public static double __exp(double __x) { + var mh$ = __exp.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__exp", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class frexp { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("frexp"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double frexp(double __x, int *__exponent) + * } + */ + public static FunctionDescriptor frexp$descriptor() { + return frexp.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double frexp(double __x, int *__exponent) + * } + */ + public static MethodHandle frexp$handle() { + return frexp.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double frexp(double __x, int *__exponent) + * } + */ + public static MemorySegment frexp$address() { + return frexp.ADDR; + } + + /** + * {@snippet lang=c : + * extern double frexp(double __x, int *__exponent) + * } + */ + public static double frexp(double __x, MemorySegment __exponent) { + var mh$ = frexp.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("frexp", __x, __exponent); + } + return (double)mh$.invokeExact(__x, __exponent); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __frexp { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__frexp"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __frexp(double __x, int *__exponent) + * } + */ + public static FunctionDescriptor __frexp$descriptor() { + return __frexp.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __frexp(double __x, int *__exponent) + * } + */ + public static MethodHandle __frexp$handle() { + return __frexp.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __frexp(double __x, int *__exponent) + * } + */ + public static MemorySegment __frexp$address() { + return __frexp.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __frexp(double __x, int *__exponent) + * } + */ + public static double __frexp(double __x, MemorySegment __exponent) { + var mh$ = __frexp.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__frexp", __x, __exponent); + } + return (double)mh$.invokeExact(__x, __exponent); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class ldexp { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("ldexp"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double ldexp(double __x, int __exponent) + * } + */ + public static FunctionDescriptor ldexp$descriptor() { + return ldexp.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double ldexp(double __x, int __exponent) + * } + */ + public static MethodHandle ldexp$handle() { + return ldexp.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double ldexp(double __x, int __exponent) + * } + */ + public static MemorySegment ldexp$address() { + return ldexp.ADDR; + } + + /** + * {@snippet lang=c : + * extern double ldexp(double __x, int __exponent) + * } + */ + public static double ldexp(double __x, int __exponent) { + var mh$ = ldexp.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("ldexp", __x, __exponent); + } + return (double)mh$.invokeExact(__x, __exponent); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __ldexp { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__ldexp"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __ldexp(double __x, int __exponent) + * } + */ + public static FunctionDescriptor __ldexp$descriptor() { + return __ldexp.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __ldexp(double __x, int __exponent) + * } + */ + public static MethodHandle __ldexp$handle() { + return __ldexp.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __ldexp(double __x, int __exponent) + * } + */ + public static MemorySegment __ldexp$address() { + return __ldexp.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __ldexp(double __x, int __exponent) + * } + */ + public static double __ldexp(double __x, int __exponent) { + var mh$ = __ldexp.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__ldexp", __x, __exponent); + } + return (double)mh$.invokeExact(__x, __exponent); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class log { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("log"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double log(double __x) + * } + */ + public static FunctionDescriptor log$descriptor() { + return log.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double log(double __x) + * } + */ + public static MethodHandle log$handle() { + return log.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double log(double __x) + * } + */ + public static MemorySegment log$address() { + return log.ADDR; + } + + /** + * {@snippet lang=c : + * extern double log(double __x) + * } + */ + public static double log(double __x) { + var mh$ = log.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("log", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __log { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__log"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __log(double __x) + * } + */ + public static FunctionDescriptor __log$descriptor() { + return __log.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __log(double __x) + * } + */ + public static MethodHandle __log$handle() { + return __log.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __log(double __x) + * } + */ + public static MemorySegment __log$address() { + return __log.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __log(double __x) + * } + */ + public static double __log(double __x) { + var mh$ = __log.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__log", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class log10 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("log10"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double log10(double __x) + * } + */ + public static FunctionDescriptor log10$descriptor() { + return log10.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double log10(double __x) + * } + */ + public static MethodHandle log10$handle() { + return log10.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double log10(double __x) + * } + */ + public static MemorySegment log10$address() { + return log10.ADDR; + } + + /** + * {@snippet lang=c : + * extern double log10(double __x) + * } + */ + public static double log10(double __x) { + var mh$ = log10.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("log10", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __log10 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__log10"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __log10(double __x) + * } + */ + public static FunctionDescriptor __log10$descriptor() { + return __log10.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __log10(double __x) + * } + */ + public static MethodHandle __log10$handle() { + return __log10.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __log10(double __x) + * } + */ + public static MemorySegment __log10$address() { + return __log10.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __log10(double __x) + * } + */ + public static double __log10(double __x) { + var mh$ = __log10.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__log10", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class modf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("modf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double modf(double __x, double *__iptr) + * } + */ + public static FunctionDescriptor modf$descriptor() { + return modf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double modf(double __x, double *__iptr) + * } + */ + public static MethodHandle modf$handle() { + return modf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double modf(double __x, double *__iptr) + * } + */ + public static MemorySegment modf$address() { + return modf.ADDR; + } + + /** + * {@snippet lang=c : + * extern double modf(double __x, double *__iptr) + * } + */ + public static double modf(double __x, MemorySegment __iptr) { + var mh$ = modf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("modf", __x, __iptr); + } + return (double)mh$.invokeExact(__x, __iptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __modf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__modf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __modf(double __x, double *__iptr) + * } + */ + public static FunctionDescriptor __modf$descriptor() { + return __modf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __modf(double __x, double *__iptr) + * } + */ + public static MethodHandle __modf$handle() { + return __modf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __modf(double __x, double *__iptr) + * } + */ + public static MemorySegment __modf$address() { + return __modf.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __modf(double __x, double *__iptr) + * } + */ + public static double __modf(double __x, MemorySegment __iptr) { + var mh$ = __modf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__modf", __x, __iptr); + } + return (double)mh$.invokeExact(__x, __iptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class expm1 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("expm1"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double expm1(double __x) + * } + */ + public static FunctionDescriptor expm1$descriptor() { + return expm1.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double expm1(double __x) + * } + */ + public static MethodHandle expm1$handle() { + return expm1.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double expm1(double __x) + * } + */ + public static MemorySegment expm1$address() { + return expm1.ADDR; + } + + /** + * {@snippet lang=c : + * extern double expm1(double __x) + * } + */ + public static double expm1(double __x) { + var mh$ = expm1.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("expm1", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __expm1 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__expm1"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __expm1(double __x) + * } + */ + public static FunctionDescriptor __expm1$descriptor() { + return __expm1.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __expm1(double __x) + * } + */ + public static MethodHandle __expm1$handle() { + return __expm1.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __expm1(double __x) + * } + */ + public static MemorySegment __expm1$address() { + return __expm1.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __expm1(double __x) + * } + */ + public static double __expm1(double __x) { + var mh$ = __expm1.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__expm1", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class log1p { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("log1p"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double log1p(double __x) + * } + */ + public static FunctionDescriptor log1p$descriptor() { + return log1p.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double log1p(double __x) + * } + */ + public static MethodHandle log1p$handle() { + return log1p.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double log1p(double __x) + * } + */ + public static MemorySegment log1p$address() { + return log1p.ADDR; + } + + /** + * {@snippet lang=c : + * extern double log1p(double __x) + * } + */ + public static double log1p(double __x) { + var mh$ = log1p.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("log1p", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __log1p { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__log1p"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __log1p(double __x) + * } + */ + public static FunctionDescriptor __log1p$descriptor() { + return __log1p.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __log1p(double __x) + * } + */ + public static MethodHandle __log1p$handle() { + return __log1p.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __log1p(double __x) + * } + */ + public static MemorySegment __log1p$address() { + return __log1p.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __log1p(double __x) + * } + */ + public static double __log1p(double __x) { + var mh$ = __log1p.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__log1p", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class logb { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("logb"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double logb(double __x) + * } + */ + public static FunctionDescriptor logb$descriptor() { + return logb.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double logb(double __x) + * } + */ + public static MethodHandle logb$handle() { + return logb.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double logb(double __x) + * } + */ + public static MemorySegment logb$address() { + return logb.ADDR; + } + + /** + * {@snippet lang=c : + * extern double logb(double __x) + * } + */ + public static double logb(double __x) { + var mh$ = logb.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("logb", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __logb { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__logb"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __logb(double __x) + * } + */ + public static FunctionDescriptor __logb$descriptor() { + return __logb.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __logb(double __x) + * } + */ + public static MethodHandle __logb$handle() { + return __logb.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __logb(double __x) + * } + */ + public static MemorySegment __logb$address() { + return __logb.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __logb(double __x) + * } + */ + public static double __logb(double __x) { + var mh$ = __logb.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__logb", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class exp2 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("exp2"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double exp2(double __x) + * } + */ + public static FunctionDescriptor exp2$descriptor() { + return exp2.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double exp2(double __x) + * } + */ + public static MethodHandle exp2$handle() { + return exp2.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double exp2(double __x) + * } + */ + public static MemorySegment exp2$address() { + return exp2.ADDR; + } + + /** + * {@snippet lang=c : + * extern double exp2(double __x) + * } + */ + public static double exp2(double __x) { + var mh$ = exp2.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("exp2", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __exp2 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__exp2"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __exp2(double __x) + * } + */ + public static FunctionDescriptor __exp2$descriptor() { + return __exp2.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __exp2(double __x) + * } + */ + public static MethodHandle __exp2$handle() { + return __exp2.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __exp2(double __x) + * } + */ + public static MemorySegment __exp2$address() { + return __exp2.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __exp2(double __x) + * } + */ + public static double __exp2(double __x) { + var mh$ = __exp2.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__exp2", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class log2 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("log2"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double log2(double __x) + * } + */ + public static FunctionDescriptor log2$descriptor() { + return log2.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double log2(double __x) + * } + */ + public static MethodHandle log2$handle() { + return log2.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double log2(double __x) + * } + */ + public static MemorySegment log2$address() { + return log2.ADDR; + } + + /** + * {@snippet lang=c : + * extern double log2(double __x) + * } + */ + public static double log2(double __x) { + var mh$ = log2.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("log2", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __log2 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__log2"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __log2(double __x) + * } + */ + public static FunctionDescriptor __log2$descriptor() { + return __log2.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __log2(double __x) + * } + */ + public static MethodHandle __log2$handle() { + return __log2.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __log2(double __x) + * } + */ + public static MemorySegment __log2$address() { + return __log2.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __log2(double __x) + * } + */ + public static double __log2(double __x) { + var mh$ = __log2.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__log2", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class pow { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("pow"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double pow(double __x, double __y) + * } + */ + public static FunctionDescriptor pow$descriptor() { + return pow.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double pow(double __x, double __y) + * } + */ + public static MethodHandle pow$handle() { + return pow.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double pow(double __x, double __y) + * } + */ + public static MemorySegment pow$address() { + return pow.ADDR; + } + + /** + * {@snippet lang=c : + * extern double pow(double __x, double __y) + * } + */ + public static double pow(double __x, double __y) { + var mh$ = pow.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("pow", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __pow { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__pow"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __pow(double __x, double __y) + * } + */ + public static FunctionDescriptor __pow$descriptor() { + return __pow.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __pow(double __x, double __y) + * } + */ + public static MethodHandle __pow$handle() { + return __pow.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __pow(double __x, double __y) + * } + */ + public static MemorySegment __pow$address() { + return __pow.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __pow(double __x, double __y) + * } + */ + public static double __pow(double __x, double __y) { + var mh$ = __pow.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__pow", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class sqrt { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("sqrt"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double sqrt(double __x) + * } + */ + public static FunctionDescriptor sqrt$descriptor() { + return sqrt.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double sqrt(double __x) + * } + */ + public static MethodHandle sqrt$handle() { + return sqrt.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double sqrt(double __x) + * } + */ + public static MemorySegment sqrt$address() { + return sqrt.ADDR; + } + + /** + * {@snippet lang=c : + * extern double sqrt(double __x) + * } + */ + public static double sqrt(double __x) { + var mh$ = sqrt.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("sqrt", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __sqrt { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__sqrt"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __sqrt(double __x) + * } + */ + public static FunctionDescriptor __sqrt$descriptor() { + return __sqrt.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __sqrt(double __x) + * } + */ + public static MethodHandle __sqrt$handle() { + return __sqrt.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __sqrt(double __x) + * } + */ + public static MemorySegment __sqrt$address() { + return __sqrt.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __sqrt(double __x) + * } + */ + public static double __sqrt(double __x) { + var mh$ = __sqrt.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__sqrt", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class hypot { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("hypot"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double hypot(double __x, double __y) + * } + */ + public static FunctionDescriptor hypot$descriptor() { + return hypot.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double hypot(double __x, double __y) + * } + */ + public static MethodHandle hypot$handle() { + return hypot.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double hypot(double __x, double __y) + * } + */ + public static MemorySegment hypot$address() { + return hypot.ADDR; + } + + /** + * {@snippet lang=c : + * extern double hypot(double __x, double __y) + * } + */ + public static double hypot(double __x, double __y) { + var mh$ = hypot.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("hypot", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __hypot { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__hypot"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __hypot(double __x, double __y) + * } + */ + public static FunctionDescriptor __hypot$descriptor() { + return __hypot.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __hypot(double __x, double __y) + * } + */ + public static MethodHandle __hypot$handle() { + return __hypot.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __hypot(double __x, double __y) + * } + */ + public static MemorySegment __hypot$address() { + return __hypot.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __hypot(double __x, double __y) + * } + */ + public static double __hypot(double __x, double __y) { + var mh$ = __hypot.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__hypot", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cbrt { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cbrt"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double cbrt(double __x) + * } + */ + public static FunctionDescriptor cbrt$descriptor() { + return cbrt.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double cbrt(double __x) + * } + */ + public static MethodHandle cbrt$handle() { + return cbrt.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double cbrt(double __x) + * } + */ + public static MemorySegment cbrt$address() { + return cbrt.ADDR; + } + + /** + * {@snippet lang=c : + * extern double cbrt(double __x) + * } + */ + public static double cbrt(double __x) { + var mh$ = cbrt.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cbrt", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __cbrt { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__cbrt"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __cbrt(double __x) + * } + */ + public static FunctionDescriptor __cbrt$descriptor() { + return __cbrt.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __cbrt(double __x) + * } + */ + public static MethodHandle __cbrt$handle() { + return __cbrt.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __cbrt(double __x) + * } + */ + public static MemorySegment __cbrt$address() { + return __cbrt.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __cbrt(double __x) + * } + */ + public static double __cbrt(double __x) { + var mh$ = __cbrt.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__cbrt", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class ceil { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("ceil"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double ceil(double __x) + * } + */ + public static FunctionDescriptor ceil$descriptor() { + return ceil.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double ceil(double __x) + * } + */ + public static MethodHandle ceil$handle() { + return ceil.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double ceil(double __x) + * } + */ + public static MemorySegment ceil$address() { + return ceil.ADDR; + } + + /** + * {@snippet lang=c : + * extern double ceil(double __x) + * } + */ + public static double ceil(double __x) { + var mh$ = ceil.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("ceil", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __ceil { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__ceil"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __ceil(double __x) + * } + */ + public static FunctionDescriptor __ceil$descriptor() { + return __ceil.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __ceil(double __x) + * } + */ + public static MethodHandle __ceil$handle() { + return __ceil.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __ceil(double __x) + * } + */ + public static MemorySegment __ceil$address() { + return __ceil.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __ceil(double __x) + * } + */ + public static double __ceil(double __x) { + var mh$ = __ceil.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__ceil", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fabs { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fabs"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double fabs(double __x) + * } + */ + public static FunctionDescriptor fabs$descriptor() { + return fabs.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double fabs(double __x) + * } + */ + public static MethodHandle fabs$handle() { + return fabs.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double fabs(double __x) + * } + */ + public static MemorySegment fabs$address() { + return fabs.ADDR; + } + + /** + * {@snippet lang=c : + * extern double fabs(double __x) + * } + */ + public static double fabs(double __x) { + var mh$ = fabs.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fabs", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fabs { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fabs"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __fabs(double __x) + * } + */ + public static FunctionDescriptor __fabs$descriptor() { + return __fabs.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __fabs(double __x) + * } + */ + public static MethodHandle __fabs$handle() { + return __fabs.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __fabs(double __x) + * } + */ + public static MemorySegment __fabs$address() { + return __fabs.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __fabs(double __x) + * } + */ + public static double __fabs(double __x) { + var mh$ = __fabs.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fabs", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class floor { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("floor"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double floor(double __x) + * } + */ + public static FunctionDescriptor floor$descriptor() { + return floor.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double floor(double __x) + * } + */ + public static MethodHandle floor$handle() { + return floor.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double floor(double __x) + * } + */ + public static MemorySegment floor$address() { + return floor.ADDR; + } + + /** + * {@snippet lang=c : + * extern double floor(double __x) + * } + */ + public static double floor(double __x) { + var mh$ = floor.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("floor", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __floor { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__floor"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __floor(double __x) + * } + */ + public static FunctionDescriptor __floor$descriptor() { + return __floor.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __floor(double __x) + * } + */ + public static MethodHandle __floor$handle() { + return __floor.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __floor(double __x) + * } + */ + public static MemorySegment __floor$address() { + return __floor.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __floor(double __x) + * } + */ + public static double __floor(double __x) { + var mh$ = __floor.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__floor", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fmod { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fmod"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double fmod(double __x, double __y) + * } + */ + public static FunctionDescriptor fmod$descriptor() { + return fmod.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double fmod(double __x, double __y) + * } + */ + public static MethodHandle fmod$handle() { + return fmod.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double fmod(double __x, double __y) + * } + */ + public static MemorySegment fmod$address() { + return fmod.ADDR; + } + + /** + * {@snippet lang=c : + * extern double fmod(double __x, double __y) + * } + */ + public static double fmod(double __x, double __y) { + var mh$ = fmod.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fmod", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fmod { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fmod"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __fmod(double __x, double __y) + * } + */ + public static FunctionDescriptor __fmod$descriptor() { + return __fmod.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __fmod(double __x, double __y) + * } + */ + public static MethodHandle __fmod$handle() { + return __fmod.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __fmod(double __x, double __y) + * } + */ + public static MemorySegment __fmod$address() { + return __fmod.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __fmod(double __x, double __y) + * } + */ + public static double __fmod(double __x, double __y) { + var mh$ = __fmod.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fmod", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class isinf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("isinf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int isinf(double __value) + * } + */ + public static FunctionDescriptor isinf$descriptor() { + return isinf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int isinf(double __value) + * } + */ + public static MethodHandle isinf$handle() { + return isinf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int isinf(double __value) + * } + */ + public static MemorySegment isinf$address() { + return isinf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int isinf(double __value) + * } + */ + public static int isinf(double __value) { + var mh$ = isinf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("isinf", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class finite { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("finite"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int finite(double __value) + * } + */ + public static FunctionDescriptor finite$descriptor() { + return finite.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int finite(double __value) + * } + */ + public static MethodHandle finite$handle() { + return finite.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int finite(double __value) + * } + */ + public static MemorySegment finite$address() { + return finite.ADDR; + } + + /** + * {@snippet lang=c : + * extern int finite(double __value) + * } + */ + public static int finite(double __value) { + var mh$ = finite.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("finite", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class drem { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("drem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double drem(double __x, double __y) + * } + */ + public static FunctionDescriptor drem$descriptor() { + return drem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double drem(double __x, double __y) + * } + */ + public static MethodHandle drem$handle() { + return drem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double drem(double __x, double __y) + * } + */ + public static MemorySegment drem$address() { + return drem.ADDR; + } + + /** + * {@snippet lang=c : + * extern double drem(double __x, double __y) + * } + */ + public static double drem(double __x, double __y) { + var mh$ = drem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("drem", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __drem { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__drem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __drem(double __x, double __y) + * } + */ + public static FunctionDescriptor __drem$descriptor() { + return __drem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __drem(double __x, double __y) + * } + */ + public static MethodHandle __drem$handle() { + return __drem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __drem(double __x, double __y) + * } + */ + public static MemorySegment __drem$address() { + return __drem.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __drem(double __x, double __y) + * } + */ + public static double __drem(double __x, double __y) { + var mh$ = __drem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__drem", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class significand { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("significand"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double significand(double __x) + * } + */ + public static FunctionDescriptor significand$descriptor() { + return significand.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double significand(double __x) + * } + */ + public static MethodHandle significand$handle() { + return significand.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double significand(double __x) + * } + */ + public static MemorySegment significand$address() { + return significand.ADDR; + } + + /** + * {@snippet lang=c : + * extern double significand(double __x) + * } + */ + public static double significand(double __x) { + var mh$ = significand.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("significand", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __significand { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__significand"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __significand(double __x) + * } + */ + public static FunctionDescriptor __significand$descriptor() { + return __significand.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __significand(double __x) + * } + */ + public static MethodHandle __significand$handle() { + return __significand.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __significand(double __x) + * } + */ + public static MemorySegment __significand$address() { + return __significand.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __significand(double __x) + * } + */ + public static double __significand(double __x) { + var mh$ = __significand.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__significand", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class copysign { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("copysign"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double copysign(double __x, double __y) + * } + */ + public static FunctionDescriptor copysign$descriptor() { + return copysign.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double copysign(double __x, double __y) + * } + */ + public static MethodHandle copysign$handle() { + return copysign.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double copysign(double __x, double __y) + * } + */ + public static MemorySegment copysign$address() { + return copysign.ADDR; + } + + /** + * {@snippet lang=c : + * extern double copysign(double __x, double __y) + * } + */ + public static double copysign(double __x, double __y) { + var mh$ = copysign.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("copysign", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __copysign { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__copysign"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __copysign(double __x, double __y) + * } + */ + public static FunctionDescriptor __copysign$descriptor() { + return __copysign.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __copysign(double __x, double __y) + * } + */ + public static MethodHandle __copysign$handle() { + return __copysign.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __copysign(double __x, double __y) + * } + */ + public static MemorySegment __copysign$address() { + return __copysign.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __copysign(double __x, double __y) + * } + */ + public static double __copysign(double __x, double __y) { + var mh$ = __copysign.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__copysign", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class nan { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("nan"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double nan(const char *__tagb) + * } + */ + public static FunctionDescriptor nan$descriptor() { + return nan.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double nan(const char *__tagb) + * } + */ + public static MethodHandle nan$handle() { + return nan.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double nan(const char *__tagb) + * } + */ + public static MemorySegment nan$address() { + return nan.ADDR; + } + + /** + * {@snippet lang=c : + * extern double nan(const char *__tagb) + * } + */ + public static double nan(MemorySegment __tagb) { + var mh$ = nan.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("nan", __tagb); + } + return (double)mh$.invokeExact(__tagb); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __nan { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__nan"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __nan(const char *__tagb) + * } + */ + public static FunctionDescriptor __nan$descriptor() { + return __nan.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __nan(const char *__tagb) + * } + */ + public static MethodHandle __nan$handle() { + return __nan.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __nan(const char *__tagb) + * } + */ + public static MemorySegment __nan$address() { + return __nan.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __nan(const char *__tagb) + * } + */ + public static double __nan(MemorySegment __tagb) { + var mh$ = __nan.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__nan", __tagb); + } + return (double)mh$.invokeExact(__tagb); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class isnan { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("isnan"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int isnan(double __value) + * } + */ + public static FunctionDescriptor isnan$descriptor() { + return isnan.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int isnan(double __value) + * } + */ + public static MethodHandle isnan$handle() { + return isnan.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int isnan(double __value) + * } + */ + public static MemorySegment isnan$address() { + return isnan.ADDR; + } + + /** + * {@snippet lang=c : + * extern int isnan(double __value) + * } + */ + public static int isnan(double __value) { + var mh$ = isnan.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("isnan", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class j0 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("j0"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double j0(double) + * } + */ + public static FunctionDescriptor j0$descriptor() { + return j0.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double j0(double) + * } + */ + public static MethodHandle j0$handle() { + return j0.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double j0(double) + * } + */ + public static MemorySegment j0$address() { + return j0.ADDR; + } + + /** + * {@snippet lang=c : + * extern double j0(double) + * } + */ + public static double j0(double x0) { + var mh$ = j0.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("j0", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __j0 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__j0"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __j0(double) + * } + */ + public static FunctionDescriptor __j0$descriptor() { + return __j0.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __j0(double) + * } + */ + public static MethodHandle __j0$handle() { + return __j0.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __j0(double) + * } + */ + public static MemorySegment __j0$address() { + return __j0.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __j0(double) + * } + */ + public static double __j0(double x0) { + var mh$ = __j0.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__j0", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class j1 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("j1"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double j1(double) + * } + */ + public static FunctionDescriptor j1$descriptor() { + return j1.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double j1(double) + * } + */ + public static MethodHandle j1$handle() { + return j1.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double j1(double) + * } + */ + public static MemorySegment j1$address() { + return j1.ADDR; + } + + /** + * {@snippet lang=c : + * extern double j1(double) + * } + */ + public static double j1(double x0) { + var mh$ = j1.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("j1", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __j1 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__j1"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __j1(double) + * } + */ + public static FunctionDescriptor __j1$descriptor() { + return __j1.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __j1(double) + * } + */ + public static MethodHandle __j1$handle() { + return __j1.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __j1(double) + * } + */ + public static MemorySegment __j1$address() { + return __j1.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __j1(double) + * } + */ + public static double __j1(double x0) { + var mh$ = __j1.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__j1", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class jn { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("jn"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double jn(int, double) + * } + */ + public static FunctionDescriptor jn$descriptor() { + return jn.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double jn(int, double) + * } + */ + public static MethodHandle jn$handle() { + return jn.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double jn(int, double) + * } + */ + public static MemorySegment jn$address() { + return jn.ADDR; + } + + /** + * {@snippet lang=c : + * extern double jn(int, double) + * } + */ + public static double jn(int x0, double x1) { + var mh$ = jn.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("jn", x0, x1); + } + return (double)mh$.invokeExact(x0, x1); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __jn { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__jn"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __jn(int, double) + * } + */ + public static FunctionDescriptor __jn$descriptor() { + return __jn.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __jn(int, double) + * } + */ + public static MethodHandle __jn$handle() { + return __jn.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __jn(int, double) + * } + */ + public static MemorySegment __jn$address() { + return __jn.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __jn(int, double) + * } + */ + public static double __jn(int x0, double x1) { + var mh$ = __jn.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__jn", x0, x1); + } + return (double)mh$.invokeExact(x0, x1); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class y0 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("y0"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double y0(double) + * } + */ + public static FunctionDescriptor y0$descriptor() { + return y0.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double y0(double) + * } + */ + public static MethodHandle y0$handle() { + return y0.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double y0(double) + * } + */ + public static MemorySegment y0$address() { + return y0.ADDR; + } + + /** + * {@snippet lang=c : + * extern double y0(double) + * } + */ + public static double y0(double x0) { + var mh$ = y0.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("y0", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __y0 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__y0"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __y0(double) + * } + */ + public static FunctionDescriptor __y0$descriptor() { + return __y0.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __y0(double) + * } + */ + public static MethodHandle __y0$handle() { + return __y0.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __y0(double) + * } + */ + public static MemorySegment __y0$address() { + return __y0.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __y0(double) + * } + */ + public static double __y0(double x0) { + var mh$ = __y0.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__y0", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class y1 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("y1"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double y1(double) + * } + */ + public static FunctionDescriptor y1$descriptor() { + return y1.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double y1(double) + * } + */ + public static MethodHandle y1$handle() { + return y1.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double y1(double) + * } + */ + public static MemorySegment y1$address() { + return y1.ADDR; + } + + /** + * {@snippet lang=c : + * extern double y1(double) + * } + */ + public static double y1(double x0) { + var mh$ = y1.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("y1", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __y1 { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__y1"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __y1(double) + * } + */ + public static FunctionDescriptor __y1$descriptor() { + return __y1.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __y1(double) + * } + */ + public static MethodHandle __y1$handle() { + return __y1.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __y1(double) + * } + */ + public static MemorySegment __y1$address() { + return __y1.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __y1(double) + * } + */ + public static double __y1(double x0) { + var mh$ = __y1.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__y1", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class yn { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("yn"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double yn(int, double) + * } + */ + public static FunctionDescriptor yn$descriptor() { + return yn.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double yn(int, double) + * } + */ + public static MethodHandle yn$handle() { + return yn.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double yn(int, double) + * } + */ + public static MemorySegment yn$address() { + return yn.ADDR; + } + + /** + * {@snippet lang=c : + * extern double yn(int, double) + * } + */ + public static double yn(int x0, double x1) { + var mh$ = yn.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("yn", x0, x1); + } + return (double)mh$.invokeExact(x0, x1); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __yn { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__yn"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __yn(int, double) + * } + */ + public static FunctionDescriptor __yn$descriptor() { + return __yn.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __yn(int, double) + * } + */ + public static MethodHandle __yn$handle() { + return __yn.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __yn(int, double) + * } + */ + public static MemorySegment __yn$address() { + return __yn.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __yn(int, double) + * } + */ + public static double __yn(int x0, double x1) { + var mh$ = __yn.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__yn", x0, x1); + } + return (double)mh$.invokeExact(x0, x1); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class erf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("erf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double erf(double) + * } + */ + public static FunctionDescriptor erf$descriptor() { + return erf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double erf(double) + * } + */ + public static MethodHandle erf$handle() { + return erf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double erf(double) + * } + */ + public static MemorySegment erf$address() { + return erf.ADDR; + } + + /** + * {@snippet lang=c : + * extern double erf(double) + * } + */ + public static double erf(double x0) { + var mh$ = erf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("erf", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __erf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__erf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __erf(double) + * } + */ + public static FunctionDescriptor __erf$descriptor() { + return __erf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __erf(double) + * } + */ + public static MethodHandle __erf$handle() { + return __erf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __erf(double) + * } + */ + public static MemorySegment __erf$address() { + return __erf.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __erf(double) + * } + */ + public static double __erf(double x0) { + var mh$ = __erf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__erf", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class erfc { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("erfc"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double erfc(double) + * } + */ + public static FunctionDescriptor erfc$descriptor() { + return erfc.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double erfc(double) + * } + */ + public static MethodHandle erfc$handle() { + return erfc.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double erfc(double) + * } + */ + public static MemorySegment erfc$address() { + return erfc.ADDR; + } + + /** + * {@snippet lang=c : + * extern double erfc(double) + * } + */ + public static double erfc(double x0) { + var mh$ = erfc.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("erfc", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __erfc { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__erfc"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __erfc(double) + * } + */ + public static FunctionDescriptor __erfc$descriptor() { + return __erfc.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __erfc(double) + * } + */ + public static MethodHandle __erfc$handle() { + return __erfc.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __erfc(double) + * } + */ + public static MemorySegment __erfc$address() { + return __erfc.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __erfc(double) + * } + */ + public static double __erfc(double x0) { + var mh$ = __erfc.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__erfc", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class lgamma { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("lgamma"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double lgamma(double) + * } + */ + public static FunctionDescriptor lgamma$descriptor() { + return lgamma.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double lgamma(double) + * } + */ + public static MethodHandle lgamma$handle() { + return lgamma.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double lgamma(double) + * } + */ + public static MemorySegment lgamma$address() { + return lgamma.ADDR; + } + + /** + * {@snippet lang=c : + * extern double lgamma(double) + * } + */ + public static double lgamma(double x0) { + var mh$ = lgamma.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("lgamma", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __lgamma { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__lgamma"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __lgamma(double) + * } + */ + public static FunctionDescriptor __lgamma$descriptor() { + return __lgamma.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __lgamma(double) + * } + */ + public static MethodHandle __lgamma$handle() { + return __lgamma.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __lgamma(double) + * } + */ + public static MemorySegment __lgamma$address() { + return __lgamma.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __lgamma(double) + * } + */ + public static double __lgamma(double x0) { + var mh$ = __lgamma.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__lgamma", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class tgamma { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("tgamma"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double tgamma(double) + * } + */ + public static FunctionDescriptor tgamma$descriptor() { + return tgamma.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double tgamma(double) + * } + */ + public static MethodHandle tgamma$handle() { + return tgamma.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double tgamma(double) + * } + */ + public static MemorySegment tgamma$address() { + return tgamma.ADDR; + } + + /** + * {@snippet lang=c : + * extern double tgamma(double) + * } + */ + public static double tgamma(double x0) { + var mh$ = tgamma.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("tgamma", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __tgamma { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__tgamma"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __tgamma(double) + * } + */ + public static FunctionDescriptor __tgamma$descriptor() { + return __tgamma.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __tgamma(double) + * } + */ + public static MethodHandle __tgamma$handle() { + return __tgamma.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __tgamma(double) + * } + */ + public static MemorySegment __tgamma$address() { + return __tgamma.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __tgamma(double) + * } + */ + public static double __tgamma(double x0) { + var mh$ = __tgamma.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__tgamma", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class gamma { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("gamma"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double gamma(double) + * } + */ + public static FunctionDescriptor gamma$descriptor() { + return gamma.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double gamma(double) + * } + */ + public static MethodHandle gamma$handle() { + return gamma.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double gamma(double) + * } + */ + public static MemorySegment gamma$address() { + return gamma.ADDR; + } + + /** + * {@snippet lang=c : + * extern double gamma(double) + * } + */ + public static double gamma(double x0) { + var mh$ = gamma.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("gamma", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __gamma { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__gamma"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __gamma(double) + * } + */ + public static FunctionDescriptor __gamma$descriptor() { + return __gamma.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __gamma(double) + * } + */ + public static MethodHandle __gamma$handle() { + return __gamma.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __gamma(double) + * } + */ + public static MemorySegment __gamma$address() { + return __gamma.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __gamma(double) + * } + */ + public static double __gamma(double x0) { + var mh$ = __gamma.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__gamma", x0); + } + return (double)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class lgamma_r { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("lgamma_r"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double lgamma_r(double, int *__signgamp) + * } + */ + public static FunctionDescriptor lgamma_r$descriptor() { + return lgamma_r.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double lgamma_r(double, int *__signgamp) + * } + */ + public static MethodHandle lgamma_r$handle() { + return lgamma_r.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double lgamma_r(double, int *__signgamp) + * } + */ + public static MemorySegment lgamma_r$address() { + return lgamma_r.ADDR; + } + + /** + * {@snippet lang=c : + * extern double lgamma_r(double, int *__signgamp) + * } + */ + public static double lgamma_r(double x0, MemorySegment __signgamp) { + var mh$ = lgamma_r.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("lgamma_r", x0, __signgamp); + } + return (double)mh$.invokeExact(x0, __signgamp); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __lgamma_r { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__lgamma_r"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __lgamma_r(double, int *__signgamp) + * } + */ + public static FunctionDescriptor __lgamma_r$descriptor() { + return __lgamma_r.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __lgamma_r(double, int *__signgamp) + * } + */ + public static MethodHandle __lgamma_r$handle() { + return __lgamma_r.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __lgamma_r(double, int *__signgamp) + * } + */ + public static MemorySegment __lgamma_r$address() { + return __lgamma_r.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __lgamma_r(double, int *__signgamp) + * } + */ + public static double __lgamma_r(double x0, MemorySegment __signgamp) { + var mh$ = __lgamma_r.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__lgamma_r", x0, __signgamp); + } + return (double)mh$.invokeExact(x0, __signgamp); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class rint { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("rint"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double rint(double __x) + * } + */ + public static FunctionDescriptor rint$descriptor() { + return rint.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double rint(double __x) + * } + */ + public static MethodHandle rint$handle() { + return rint.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double rint(double __x) + * } + */ + public static MemorySegment rint$address() { + return rint.ADDR; + } + + /** + * {@snippet lang=c : + * extern double rint(double __x) + * } + */ + public static double rint(double __x) { + var mh$ = rint.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("rint", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __rint { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__rint"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __rint(double __x) + * } + */ + public static FunctionDescriptor __rint$descriptor() { + return __rint.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __rint(double __x) + * } + */ + public static MethodHandle __rint$handle() { + return __rint.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __rint(double __x) + * } + */ + public static MemorySegment __rint$address() { + return __rint.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __rint(double __x) + * } + */ + public static double __rint(double __x) { + var mh$ = __rint.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__rint", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class nextafter { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("nextafter"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double nextafter(double __x, double __y) + * } + */ + public static FunctionDescriptor nextafter$descriptor() { + return nextafter.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double nextafter(double __x, double __y) + * } + */ + public static MethodHandle nextafter$handle() { + return nextafter.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double nextafter(double __x, double __y) + * } + */ + public static MemorySegment nextafter$address() { + return nextafter.ADDR; + } + + /** + * {@snippet lang=c : + * extern double nextafter(double __x, double __y) + * } + */ + public static double nextafter(double __x, double __y) { + var mh$ = nextafter.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("nextafter", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __nextafter { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__nextafter"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __nextafter(double __x, double __y) + * } + */ + public static FunctionDescriptor __nextafter$descriptor() { + return __nextafter.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __nextafter(double __x, double __y) + * } + */ + public static MethodHandle __nextafter$handle() { + return __nextafter.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __nextafter(double __x, double __y) + * } + */ + public static MemorySegment __nextafter$address() { + return __nextafter.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __nextafter(double __x, double __y) + * } + */ + public static double __nextafter(double __x, double __y) { + var mh$ = __nextafter.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__nextafter", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class remainder { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("remainder"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double remainder(double __x, double __y) + * } + */ + public static FunctionDescriptor remainder$descriptor() { + return remainder.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double remainder(double __x, double __y) + * } + */ + public static MethodHandle remainder$handle() { + return remainder.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double remainder(double __x, double __y) + * } + */ + public static MemorySegment remainder$address() { + return remainder.ADDR; + } + + /** + * {@snippet lang=c : + * extern double remainder(double __x, double __y) + * } + */ + public static double remainder(double __x, double __y) { + var mh$ = remainder.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("remainder", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __remainder { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__remainder"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __remainder(double __x, double __y) + * } + */ + public static FunctionDescriptor __remainder$descriptor() { + return __remainder.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __remainder(double __x, double __y) + * } + */ + public static MethodHandle __remainder$handle() { + return __remainder.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __remainder(double __x, double __y) + * } + */ + public static MemorySegment __remainder$address() { + return __remainder.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __remainder(double __x, double __y) + * } + */ + public static double __remainder(double __x, double __y) { + var mh$ = __remainder.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__remainder", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class scalbn { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("scalbn"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double scalbn(double __x, int __n) + * } + */ + public static FunctionDescriptor scalbn$descriptor() { + return scalbn.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double scalbn(double __x, int __n) + * } + */ + public static MethodHandle scalbn$handle() { + return scalbn.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double scalbn(double __x, int __n) + * } + */ + public static MemorySegment scalbn$address() { + return scalbn.ADDR; + } + + /** + * {@snippet lang=c : + * extern double scalbn(double __x, int __n) + * } + */ + public static double scalbn(double __x, int __n) { + var mh$ = scalbn.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("scalbn", __x, __n); + } + return (double)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __scalbn { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__scalbn"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __scalbn(double __x, int __n) + * } + */ + public static FunctionDescriptor __scalbn$descriptor() { + return __scalbn.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __scalbn(double __x, int __n) + * } + */ + public static MethodHandle __scalbn$handle() { + return __scalbn.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __scalbn(double __x, int __n) + * } + */ + public static MemorySegment __scalbn$address() { + return __scalbn.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __scalbn(double __x, int __n) + * } + */ + public static double __scalbn(double __x, int __n) { + var mh$ = __scalbn.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__scalbn", __x, __n); + } + return (double)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class ilogb { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("ilogb"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int ilogb(double __x) + * } + */ + public static FunctionDescriptor ilogb$descriptor() { + return ilogb.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int ilogb(double __x) + * } + */ + public static MethodHandle ilogb$handle() { + return ilogb.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int ilogb(double __x) + * } + */ + public static MemorySegment ilogb$address() { + return ilogb.ADDR; + } + + /** + * {@snippet lang=c : + * extern int ilogb(double __x) + * } + */ + public static int ilogb(double __x) { + var mh$ = ilogb.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("ilogb", __x); + } + return (int)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __ilogb { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__ilogb"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __ilogb(double __x) + * } + */ + public static FunctionDescriptor __ilogb$descriptor() { + return __ilogb.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __ilogb(double __x) + * } + */ + public static MethodHandle __ilogb$handle() { + return __ilogb.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __ilogb(double __x) + * } + */ + public static MemorySegment __ilogb$address() { + return __ilogb.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __ilogb(double __x) + * } + */ + public static int __ilogb(double __x) { + var mh$ = __ilogb.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__ilogb", __x); + } + return (int)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class scalbln { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_LONG + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("scalbln"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double scalbln(double __x, long __n) + * } + */ + public static FunctionDescriptor scalbln$descriptor() { + return scalbln.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double scalbln(double __x, long __n) + * } + */ + public static MethodHandle scalbln$handle() { + return scalbln.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double scalbln(double __x, long __n) + * } + */ + public static MemorySegment scalbln$address() { + return scalbln.ADDR; + } + + /** + * {@snippet lang=c : + * extern double scalbln(double __x, long __n) + * } + */ + public static double scalbln(double __x, long __n) { + var mh$ = scalbln.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("scalbln", __x, __n); + } + return (double)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __scalbln { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_LONG + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__scalbln"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __scalbln(double __x, long __n) + * } + */ + public static FunctionDescriptor __scalbln$descriptor() { + return __scalbln.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __scalbln(double __x, long __n) + * } + */ + public static MethodHandle __scalbln$handle() { + return __scalbln.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __scalbln(double __x, long __n) + * } + */ + public static MemorySegment __scalbln$address() { + return __scalbln.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __scalbln(double __x, long __n) + * } + */ + public static double __scalbln(double __x, long __n) { + var mh$ = __scalbln.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__scalbln", __x, __n); + } + return (double)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class nearbyint { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("nearbyint"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double nearbyint(double __x) + * } + */ + public static FunctionDescriptor nearbyint$descriptor() { + return nearbyint.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double nearbyint(double __x) + * } + */ + public static MethodHandle nearbyint$handle() { + return nearbyint.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double nearbyint(double __x) + * } + */ + public static MemorySegment nearbyint$address() { + return nearbyint.ADDR; + } + + /** + * {@snippet lang=c : + * extern double nearbyint(double __x) + * } + */ + public static double nearbyint(double __x) { + var mh$ = nearbyint.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("nearbyint", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __nearbyint { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__nearbyint"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __nearbyint(double __x) + * } + */ + public static FunctionDescriptor __nearbyint$descriptor() { + return __nearbyint.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __nearbyint(double __x) + * } + */ + public static MethodHandle __nearbyint$handle() { + return __nearbyint.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __nearbyint(double __x) + * } + */ + public static MemorySegment __nearbyint$address() { + return __nearbyint.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __nearbyint(double __x) + * } + */ + public static double __nearbyint(double __x) { + var mh$ = __nearbyint.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__nearbyint", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class round { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("round"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double round(double __x) + * } + */ + public static FunctionDescriptor round$descriptor() { + return round.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double round(double __x) + * } + */ + public static MethodHandle round$handle() { + return round.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double round(double __x) + * } + */ + public static MemorySegment round$address() { + return round.ADDR; + } + + /** + * {@snippet lang=c : + * extern double round(double __x) + * } + */ + public static double round(double __x) { + var mh$ = round.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("round", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __round { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__round"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __round(double __x) + * } + */ + public static FunctionDescriptor __round$descriptor() { + return __round.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __round(double __x) + * } + */ + public static MethodHandle __round$handle() { + return __round.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __round(double __x) + * } + */ + public static MemorySegment __round$address() { + return __round.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __round(double __x) + * } + */ + public static double __round(double __x) { + var mh$ = __round.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__round", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class trunc { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("trunc"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double trunc(double __x) + * } + */ + public static FunctionDescriptor trunc$descriptor() { + return trunc.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double trunc(double __x) + * } + */ + public static MethodHandle trunc$handle() { + return trunc.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double trunc(double __x) + * } + */ + public static MemorySegment trunc$address() { + return trunc.ADDR; + } + + /** + * {@snippet lang=c : + * extern double trunc(double __x) + * } + */ + public static double trunc(double __x) { + var mh$ = trunc.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("trunc", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __trunc { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__trunc"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __trunc(double __x) + * } + */ + public static FunctionDescriptor __trunc$descriptor() { + return __trunc.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __trunc(double __x) + * } + */ + public static MethodHandle __trunc$handle() { + return __trunc.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __trunc(double __x) + * } + */ + public static MemorySegment __trunc$address() { + return __trunc.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __trunc(double __x) + * } + */ + public static double __trunc(double __x) { + var mh$ = __trunc.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__trunc", __x); + } + return (double)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class remquo { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("remquo"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double remquo(double __x, double __y, int *__quo) + * } + */ + public static FunctionDescriptor remquo$descriptor() { + return remquo.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double remquo(double __x, double __y, int *__quo) + * } + */ + public static MethodHandle remquo$handle() { + return remquo.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double remquo(double __x, double __y, int *__quo) + * } + */ + public static MemorySegment remquo$address() { + return remquo.ADDR; + } + + /** + * {@snippet lang=c : + * extern double remquo(double __x, double __y, int *__quo) + * } + */ + public static double remquo(double __x, double __y, MemorySegment __quo) { + var mh$ = remquo.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("remquo", __x, __y, __quo); + } + return (double)mh$.invokeExact(__x, __y, __quo); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __remquo { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__remquo"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __remquo(double __x, double __y, int *__quo) + * } + */ + public static FunctionDescriptor __remquo$descriptor() { + return __remquo.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __remquo(double __x, double __y, int *__quo) + * } + */ + public static MethodHandle __remquo$handle() { + return __remquo.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __remquo(double __x, double __y, int *__quo) + * } + */ + public static MemorySegment __remquo$address() { + return __remquo.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __remquo(double __x, double __y, int *__quo) + * } + */ + public static double __remquo(double __x, double __y, MemorySegment __quo) { + var mh$ = __remquo.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__remquo", __x, __y, __quo); + } + return (double)mh$.invokeExact(__x, __y, __quo); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class lrint { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("lrint"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long lrint(double __x) + * } + */ + public static FunctionDescriptor lrint$descriptor() { + return lrint.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long lrint(double __x) + * } + */ + public static MethodHandle lrint$handle() { + return lrint.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long lrint(double __x) + * } + */ + public static MemorySegment lrint$address() { + return lrint.ADDR; + } + + /** + * {@snippet lang=c : + * extern long lrint(double __x) + * } + */ + public static long lrint(double __x) { + var mh$ = lrint.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("lrint", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __lrint { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__lrint"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long __lrint(double __x) + * } + */ + public static FunctionDescriptor __lrint$descriptor() { + return __lrint.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long __lrint(double __x) + * } + */ + public static MethodHandle __lrint$handle() { + return __lrint.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long __lrint(double __x) + * } + */ + public static MemorySegment __lrint$address() { + return __lrint.ADDR; + } + + /** + * {@snippet lang=c : + * extern long __lrint(double __x) + * } + */ + public static long __lrint(double __x) { + var mh$ = __lrint.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__lrint", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class llrint { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG_LONG, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("llrint"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long long llrint(double __x) + * } + */ + public static FunctionDescriptor llrint$descriptor() { + return llrint.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long long llrint(double __x) + * } + */ + public static MethodHandle llrint$handle() { + return llrint.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long long llrint(double __x) + * } + */ + public static MemorySegment llrint$address() { + return llrint.ADDR; + } + + /** + * {@snippet lang=c : + * extern long long llrint(double __x) + * } + */ + public static long llrint(double __x) { + var mh$ = llrint.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("llrint", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __llrint { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG_LONG, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__llrint"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long long __llrint(double __x) + * } + */ + public static FunctionDescriptor __llrint$descriptor() { + return __llrint.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long long __llrint(double __x) + * } + */ + public static MethodHandle __llrint$handle() { + return __llrint.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long long __llrint(double __x) + * } + */ + public static MemorySegment __llrint$address() { + return __llrint.ADDR; + } + + /** + * {@snippet lang=c : + * extern long long __llrint(double __x) + * } + */ + public static long __llrint(double __x) { + var mh$ = __llrint.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__llrint", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class lround { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("lround"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long lround(double __x) + * } + */ + public static FunctionDescriptor lround$descriptor() { + return lround.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long lround(double __x) + * } + */ + public static MethodHandle lround$handle() { + return lround.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long lround(double __x) + * } + */ + public static MemorySegment lround$address() { + return lround.ADDR; + } + + /** + * {@snippet lang=c : + * extern long lround(double __x) + * } + */ + public static long lround(double __x) { + var mh$ = lround.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("lround", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __lround { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__lround"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long __lround(double __x) + * } + */ + public static FunctionDescriptor __lround$descriptor() { + return __lround.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long __lround(double __x) + * } + */ + public static MethodHandle __lround$handle() { + return __lround.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long __lround(double __x) + * } + */ + public static MemorySegment __lround$address() { + return __lround.ADDR; + } + + /** + * {@snippet lang=c : + * extern long __lround(double __x) + * } + */ + public static long __lround(double __x) { + var mh$ = __lround.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__lround", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class llround { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG_LONG, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("llround"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long long llround(double __x) + * } + */ + public static FunctionDescriptor llround$descriptor() { + return llround.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long long llround(double __x) + * } + */ + public static MethodHandle llround$handle() { + return llround.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long long llround(double __x) + * } + */ + public static MemorySegment llround$address() { + return llround.ADDR; + } + + /** + * {@snippet lang=c : + * extern long long llround(double __x) + * } + */ + public static long llround(double __x) { + var mh$ = llround.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("llround", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __llround { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG_LONG, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__llround"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long long __llround(double __x) + * } + */ + public static FunctionDescriptor __llround$descriptor() { + return __llround.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long long __llround(double __x) + * } + */ + public static MethodHandle __llround$handle() { + return __llround.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long long __llround(double __x) + * } + */ + public static MemorySegment __llround$address() { + return __llround.ADDR; + } + + /** + * {@snippet lang=c : + * extern long long __llround(double __x) + * } + */ + public static long __llround(double __x) { + var mh$ = __llround.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__llround", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fdim { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fdim"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double fdim(double __x, double __y) + * } + */ + public static FunctionDescriptor fdim$descriptor() { + return fdim.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double fdim(double __x, double __y) + * } + */ + public static MethodHandle fdim$handle() { + return fdim.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double fdim(double __x, double __y) + * } + */ + public static MemorySegment fdim$address() { + return fdim.ADDR; + } + + /** + * {@snippet lang=c : + * extern double fdim(double __x, double __y) + * } + */ + public static double fdim(double __x, double __y) { + var mh$ = fdim.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fdim", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fdim { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fdim"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __fdim(double __x, double __y) + * } + */ + public static FunctionDescriptor __fdim$descriptor() { + return __fdim.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __fdim(double __x, double __y) + * } + */ + public static MethodHandle __fdim$handle() { + return __fdim.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __fdim(double __x, double __y) + * } + */ + public static MemorySegment __fdim$address() { + return __fdim.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __fdim(double __x, double __y) + * } + */ + public static double __fdim(double __x, double __y) { + var mh$ = __fdim.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fdim", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fmax { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fmax"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double fmax(double __x, double __y) + * } + */ + public static FunctionDescriptor fmax$descriptor() { + return fmax.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double fmax(double __x, double __y) + * } + */ + public static MethodHandle fmax$handle() { + return fmax.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double fmax(double __x, double __y) + * } + */ + public static MemorySegment fmax$address() { + return fmax.ADDR; + } + + /** + * {@snippet lang=c : + * extern double fmax(double __x, double __y) + * } + */ + public static double fmax(double __x, double __y) { + var mh$ = fmax.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fmax", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fmax { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fmax"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __fmax(double __x, double __y) + * } + */ + public static FunctionDescriptor __fmax$descriptor() { + return __fmax.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __fmax(double __x, double __y) + * } + */ + public static MethodHandle __fmax$handle() { + return __fmax.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __fmax(double __x, double __y) + * } + */ + public static MemorySegment __fmax$address() { + return __fmax.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __fmax(double __x, double __y) + * } + */ + public static double __fmax(double __x, double __y) { + var mh$ = __fmax.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fmax", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fmin { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fmin"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double fmin(double __x, double __y) + * } + */ + public static FunctionDescriptor fmin$descriptor() { + return fmin.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double fmin(double __x, double __y) + * } + */ + public static MethodHandle fmin$handle() { + return fmin.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double fmin(double __x, double __y) + * } + */ + public static MemorySegment fmin$address() { + return fmin.ADDR; + } + + /** + * {@snippet lang=c : + * extern double fmin(double __x, double __y) + * } + */ + public static double fmin(double __x, double __y) { + var mh$ = fmin.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fmin", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fmin { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fmin"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __fmin(double __x, double __y) + * } + */ + public static FunctionDescriptor __fmin$descriptor() { + return __fmin.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __fmin(double __x, double __y) + * } + */ + public static MethodHandle __fmin$handle() { + return __fmin.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __fmin(double __x, double __y) + * } + */ + public static MemorySegment __fmin$address() { + return __fmin.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __fmin(double __x, double __y) + * } + */ + public static double __fmin(double __x, double __y) { + var mh$ = __fmin.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fmin", __x, __y); + } + return (double)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fma { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fma"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double fma(double __x, double __y, double __z) + * } + */ + public static FunctionDescriptor fma$descriptor() { + return fma.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double fma(double __x, double __y, double __z) + * } + */ + public static MethodHandle fma$handle() { + return fma.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double fma(double __x, double __y, double __z) + * } + */ + public static MemorySegment fma$address() { + return fma.ADDR; + } + + /** + * {@snippet lang=c : + * extern double fma(double __x, double __y, double __z) + * } + */ + public static double fma(double __x, double __y, double __z) { + var mh$ = fma.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fma", __x, __y, __z); + } + return (double)mh$.invokeExact(__x, __y, __z); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fma { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fma"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __fma(double __x, double __y, double __z) + * } + */ + public static FunctionDescriptor __fma$descriptor() { + return __fma.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __fma(double __x, double __y, double __z) + * } + */ + public static MethodHandle __fma$handle() { + return __fma.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __fma(double __x, double __y, double __z) + * } + */ + public static MemorySegment __fma$address() { + return __fma.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __fma(double __x, double __y, double __z) + * } + */ + public static double __fma(double __x, double __y, double __z) { + var mh$ = __fma.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fma", __x, __y, __z); + } + return (double)mh$.invokeExact(__x, __y, __z); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class scalb { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("scalb"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double scalb(double __x, double __n) + * } + */ + public static FunctionDescriptor scalb$descriptor() { + return scalb.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double scalb(double __x, double __n) + * } + */ + public static MethodHandle scalb$handle() { + return scalb.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double scalb(double __x, double __n) + * } + */ + public static MemorySegment scalb$address() { + return scalb.ADDR; + } + + /** + * {@snippet lang=c : + * extern double scalb(double __x, double __n) + * } + */ + public static double scalb(double __x, double __n) { + var mh$ = scalb.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("scalb", __x, __n); + } + return (double)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __scalb { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__scalb"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern double __scalb(double __x, double __n) + * } + */ + public static FunctionDescriptor __scalb$descriptor() { + return __scalb.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern double __scalb(double __x, double __n) + * } + */ + public static MethodHandle __scalb$handle() { + return __scalb.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern double __scalb(double __x, double __n) + * } + */ + public static MemorySegment __scalb$address() { + return __scalb.ADDR; + } + + /** + * {@snippet lang=c : + * extern double __scalb(double __x, double __n) + * } + */ + public static double __scalb(double __x, double __n) { + var mh$ = __scalb.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__scalb", __x, __n); + } + return (double)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fpclassifyf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fpclassifyf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __fpclassifyf(float __value) + * } + */ + public static FunctionDescriptor __fpclassifyf$descriptor() { + return __fpclassifyf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __fpclassifyf(float __value) + * } + */ + public static MethodHandle __fpclassifyf$handle() { + return __fpclassifyf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __fpclassifyf(float __value) + * } + */ + public static MemorySegment __fpclassifyf$address() { + return __fpclassifyf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __fpclassifyf(float __value) + * } + */ + public static int __fpclassifyf(float __value) { + var mh$ = __fpclassifyf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fpclassifyf", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __signbitf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__signbitf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __signbitf(float __value) + * } + */ + public static FunctionDescriptor __signbitf$descriptor() { + return __signbitf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __signbitf(float __value) + * } + */ + public static MethodHandle __signbitf$handle() { + return __signbitf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __signbitf(float __value) + * } + */ + public static MemorySegment __signbitf$address() { + return __signbitf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __signbitf(float __value) + * } + */ + public static int __signbitf(float __value) { + var mh$ = __signbitf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__signbitf", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __isinff { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__isinff"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __isinff(float __value) + * } + */ + public static FunctionDescriptor __isinff$descriptor() { + return __isinff.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __isinff(float __value) + * } + */ + public static MethodHandle __isinff$handle() { + return __isinff.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __isinff(float __value) + * } + */ + public static MemorySegment __isinff$address() { + return __isinff.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __isinff(float __value) + * } + */ + public static int __isinff(float __value) { + var mh$ = __isinff.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__isinff", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __finitef { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__finitef"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __finitef(float __value) + * } + */ + public static FunctionDescriptor __finitef$descriptor() { + return __finitef.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __finitef(float __value) + * } + */ + public static MethodHandle __finitef$handle() { + return __finitef.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __finitef(float __value) + * } + */ + public static MemorySegment __finitef$address() { + return __finitef.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __finitef(float __value) + * } + */ + public static int __finitef(float __value) { + var mh$ = __finitef.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__finitef", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __isnanf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__isnanf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __isnanf(float __value) + * } + */ + public static FunctionDescriptor __isnanf$descriptor() { + return __isnanf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __isnanf(float __value) + * } + */ + public static MethodHandle __isnanf$handle() { + return __isnanf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __isnanf(float __value) + * } + */ + public static MemorySegment __isnanf$address() { + return __isnanf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __isnanf(float __value) + * } + */ + public static int __isnanf(float __value) { + var mh$ = __isnanf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__isnanf", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __iseqsigf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__iseqsigf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __iseqsigf(float __x, float __y) + * } + */ + public static FunctionDescriptor __iseqsigf$descriptor() { + return __iseqsigf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __iseqsigf(float __x, float __y) + * } + */ + public static MethodHandle __iseqsigf$handle() { + return __iseqsigf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __iseqsigf(float __x, float __y) + * } + */ + public static MemorySegment __iseqsigf$address() { + return __iseqsigf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __iseqsigf(float __x, float __y) + * } + */ + public static int __iseqsigf(float __x, float __y) { + var mh$ = __iseqsigf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__iseqsigf", __x, __y); + } + return (int)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __issignalingf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__issignalingf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __issignalingf(float __value) + * } + */ + public static FunctionDescriptor __issignalingf$descriptor() { + return __issignalingf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __issignalingf(float __value) + * } + */ + public static MethodHandle __issignalingf$handle() { + return __issignalingf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __issignalingf(float __value) + * } + */ + public static MemorySegment __issignalingf$address() { + return __issignalingf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __issignalingf(float __value) + * } + */ + public static int __issignalingf(float __value) { + var mh$ = __issignalingf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__issignalingf", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class acosf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("acosf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float acosf(float __x) + * } + */ + public static FunctionDescriptor acosf$descriptor() { + return acosf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float acosf(float __x) + * } + */ + public static MethodHandle acosf$handle() { + return acosf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float acosf(float __x) + * } + */ + public static MemorySegment acosf$address() { + return acosf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float acosf(float __x) + * } + */ + public static float acosf(float __x) { + var mh$ = acosf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("acosf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __acosf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__acosf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __acosf(float __x) + * } + */ + public static FunctionDescriptor __acosf$descriptor() { + return __acosf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __acosf(float __x) + * } + */ + public static MethodHandle __acosf$handle() { + return __acosf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __acosf(float __x) + * } + */ + public static MemorySegment __acosf$address() { + return __acosf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __acosf(float __x) + * } + */ + public static float __acosf(float __x) { + var mh$ = __acosf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__acosf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class asinf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("asinf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float asinf(float __x) + * } + */ + public static FunctionDescriptor asinf$descriptor() { + return asinf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float asinf(float __x) + * } + */ + public static MethodHandle asinf$handle() { + return asinf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float asinf(float __x) + * } + */ + public static MemorySegment asinf$address() { + return asinf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float asinf(float __x) + * } + */ + public static float asinf(float __x) { + var mh$ = asinf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("asinf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __asinf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__asinf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __asinf(float __x) + * } + */ + public static FunctionDescriptor __asinf$descriptor() { + return __asinf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __asinf(float __x) + * } + */ + public static MethodHandle __asinf$handle() { + return __asinf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __asinf(float __x) + * } + */ + public static MemorySegment __asinf$address() { + return __asinf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __asinf(float __x) + * } + */ + public static float __asinf(float __x) { + var mh$ = __asinf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__asinf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class atanf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("atanf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float atanf(float __x) + * } + */ + public static FunctionDescriptor atanf$descriptor() { + return atanf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float atanf(float __x) + * } + */ + public static MethodHandle atanf$handle() { + return atanf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float atanf(float __x) + * } + */ + public static MemorySegment atanf$address() { + return atanf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float atanf(float __x) + * } + */ + public static float atanf(float __x) { + var mh$ = atanf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("atanf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __atanf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__atanf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __atanf(float __x) + * } + */ + public static FunctionDescriptor __atanf$descriptor() { + return __atanf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __atanf(float __x) + * } + */ + public static MethodHandle __atanf$handle() { + return __atanf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __atanf(float __x) + * } + */ + public static MemorySegment __atanf$address() { + return __atanf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __atanf(float __x) + * } + */ + public static float __atanf(float __x) { + var mh$ = __atanf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__atanf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class atan2f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("atan2f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float atan2f(float __y, float __x) + * } + */ + public static FunctionDescriptor atan2f$descriptor() { + return atan2f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float atan2f(float __y, float __x) + * } + */ + public static MethodHandle atan2f$handle() { + return atan2f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float atan2f(float __y, float __x) + * } + */ + public static MemorySegment atan2f$address() { + return atan2f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float atan2f(float __y, float __x) + * } + */ + public static float atan2f(float __y, float __x) { + var mh$ = atan2f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("atan2f", __y, __x); + } + return (float)mh$.invokeExact(__y, __x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __atan2f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__atan2f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __atan2f(float __y, float __x) + * } + */ + public static FunctionDescriptor __atan2f$descriptor() { + return __atan2f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __atan2f(float __y, float __x) + * } + */ + public static MethodHandle __atan2f$handle() { + return __atan2f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __atan2f(float __y, float __x) + * } + */ + public static MemorySegment __atan2f$address() { + return __atan2f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __atan2f(float __y, float __x) + * } + */ + public static float __atan2f(float __y, float __x) { + var mh$ = __atan2f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__atan2f", __y, __x); + } + return (float)mh$.invokeExact(__y, __x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cosf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cosf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float cosf(float __x) + * } + */ + public static FunctionDescriptor cosf$descriptor() { + return cosf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float cosf(float __x) + * } + */ + public static MethodHandle cosf$handle() { + return cosf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float cosf(float __x) + * } + */ + public static MemorySegment cosf$address() { + return cosf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float cosf(float __x) + * } + */ + public static float cosf(float __x) { + var mh$ = cosf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cosf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __cosf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__cosf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __cosf(float __x) + * } + */ + public static FunctionDescriptor __cosf$descriptor() { + return __cosf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __cosf(float __x) + * } + */ + public static MethodHandle __cosf$handle() { + return __cosf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __cosf(float __x) + * } + */ + public static MemorySegment __cosf$address() { + return __cosf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __cosf(float __x) + * } + */ + public static float __cosf(float __x) { + var mh$ = __cosf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__cosf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class sinf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("sinf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float sinf(float __x) + * } + */ + public static FunctionDescriptor sinf$descriptor() { + return sinf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float sinf(float __x) + * } + */ + public static MethodHandle sinf$handle() { + return sinf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float sinf(float __x) + * } + */ + public static MemorySegment sinf$address() { + return sinf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float sinf(float __x) + * } + */ + public static float sinf(float __x) { + var mh$ = sinf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("sinf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __sinf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__sinf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __sinf(float __x) + * } + */ + public static FunctionDescriptor __sinf$descriptor() { + return __sinf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __sinf(float __x) + * } + */ + public static MethodHandle __sinf$handle() { + return __sinf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __sinf(float __x) + * } + */ + public static MemorySegment __sinf$address() { + return __sinf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __sinf(float __x) + * } + */ + public static float __sinf(float __x) { + var mh$ = __sinf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__sinf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class tanf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("tanf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float tanf(float __x) + * } + */ + public static FunctionDescriptor tanf$descriptor() { + return tanf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float tanf(float __x) + * } + */ + public static MethodHandle tanf$handle() { + return tanf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float tanf(float __x) + * } + */ + public static MemorySegment tanf$address() { + return tanf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float tanf(float __x) + * } + */ + public static float tanf(float __x) { + var mh$ = tanf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("tanf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __tanf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__tanf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __tanf(float __x) + * } + */ + public static FunctionDescriptor __tanf$descriptor() { + return __tanf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __tanf(float __x) + * } + */ + public static MethodHandle __tanf$handle() { + return __tanf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __tanf(float __x) + * } + */ + public static MemorySegment __tanf$address() { + return __tanf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __tanf(float __x) + * } + */ + public static float __tanf(float __x) { + var mh$ = __tanf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__tanf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class coshf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("coshf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float coshf(float __x) + * } + */ + public static FunctionDescriptor coshf$descriptor() { + return coshf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float coshf(float __x) + * } + */ + public static MethodHandle coshf$handle() { + return coshf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float coshf(float __x) + * } + */ + public static MemorySegment coshf$address() { + return coshf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float coshf(float __x) + * } + */ + public static float coshf(float __x) { + var mh$ = coshf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("coshf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __coshf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__coshf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __coshf(float __x) + * } + */ + public static FunctionDescriptor __coshf$descriptor() { + return __coshf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __coshf(float __x) + * } + */ + public static MethodHandle __coshf$handle() { + return __coshf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __coshf(float __x) + * } + */ + public static MemorySegment __coshf$address() { + return __coshf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __coshf(float __x) + * } + */ + public static float __coshf(float __x) { + var mh$ = __coshf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__coshf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class sinhf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("sinhf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float sinhf(float __x) + * } + */ + public static FunctionDescriptor sinhf$descriptor() { + return sinhf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float sinhf(float __x) + * } + */ + public static MethodHandle sinhf$handle() { + return sinhf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float sinhf(float __x) + * } + */ + public static MemorySegment sinhf$address() { + return sinhf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float sinhf(float __x) + * } + */ + public static float sinhf(float __x) { + var mh$ = sinhf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("sinhf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __sinhf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__sinhf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __sinhf(float __x) + * } + */ + public static FunctionDescriptor __sinhf$descriptor() { + return __sinhf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __sinhf(float __x) + * } + */ + public static MethodHandle __sinhf$handle() { + return __sinhf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __sinhf(float __x) + * } + */ + public static MemorySegment __sinhf$address() { + return __sinhf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __sinhf(float __x) + * } + */ + public static float __sinhf(float __x) { + var mh$ = __sinhf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__sinhf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class tanhf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("tanhf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float tanhf(float __x) + * } + */ + public static FunctionDescriptor tanhf$descriptor() { + return tanhf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float tanhf(float __x) + * } + */ + public static MethodHandle tanhf$handle() { + return tanhf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float tanhf(float __x) + * } + */ + public static MemorySegment tanhf$address() { + return tanhf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float tanhf(float __x) + * } + */ + public static float tanhf(float __x) { + var mh$ = tanhf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("tanhf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __tanhf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__tanhf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __tanhf(float __x) + * } + */ + public static FunctionDescriptor __tanhf$descriptor() { + return __tanhf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __tanhf(float __x) + * } + */ + public static MethodHandle __tanhf$handle() { + return __tanhf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __tanhf(float __x) + * } + */ + public static MemorySegment __tanhf$address() { + return __tanhf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __tanhf(float __x) + * } + */ + public static float __tanhf(float __x) { + var mh$ = __tanhf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__tanhf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class acoshf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("acoshf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float acoshf(float __x) + * } + */ + public static FunctionDescriptor acoshf$descriptor() { + return acoshf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float acoshf(float __x) + * } + */ + public static MethodHandle acoshf$handle() { + return acoshf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float acoshf(float __x) + * } + */ + public static MemorySegment acoshf$address() { + return acoshf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float acoshf(float __x) + * } + */ + public static float acoshf(float __x) { + var mh$ = acoshf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("acoshf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __acoshf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__acoshf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __acoshf(float __x) + * } + */ + public static FunctionDescriptor __acoshf$descriptor() { + return __acoshf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __acoshf(float __x) + * } + */ + public static MethodHandle __acoshf$handle() { + return __acoshf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __acoshf(float __x) + * } + */ + public static MemorySegment __acoshf$address() { + return __acoshf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __acoshf(float __x) + * } + */ + public static float __acoshf(float __x) { + var mh$ = __acoshf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__acoshf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class asinhf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("asinhf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float asinhf(float __x) + * } + */ + public static FunctionDescriptor asinhf$descriptor() { + return asinhf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float asinhf(float __x) + * } + */ + public static MethodHandle asinhf$handle() { + return asinhf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float asinhf(float __x) + * } + */ + public static MemorySegment asinhf$address() { + return asinhf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float asinhf(float __x) + * } + */ + public static float asinhf(float __x) { + var mh$ = asinhf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("asinhf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __asinhf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__asinhf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __asinhf(float __x) + * } + */ + public static FunctionDescriptor __asinhf$descriptor() { + return __asinhf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __asinhf(float __x) + * } + */ + public static MethodHandle __asinhf$handle() { + return __asinhf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __asinhf(float __x) + * } + */ + public static MemorySegment __asinhf$address() { + return __asinhf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __asinhf(float __x) + * } + */ + public static float __asinhf(float __x) { + var mh$ = __asinhf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__asinhf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class atanhf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("atanhf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float atanhf(float __x) + * } + */ + public static FunctionDescriptor atanhf$descriptor() { + return atanhf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float atanhf(float __x) + * } + */ + public static MethodHandle atanhf$handle() { + return atanhf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float atanhf(float __x) + * } + */ + public static MemorySegment atanhf$address() { + return atanhf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float atanhf(float __x) + * } + */ + public static float atanhf(float __x) { + var mh$ = atanhf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("atanhf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __atanhf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__atanhf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __atanhf(float __x) + * } + */ + public static FunctionDescriptor __atanhf$descriptor() { + return __atanhf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __atanhf(float __x) + * } + */ + public static MethodHandle __atanhf$handle() { + return __atanhf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __atanhf(float __x) + * } + */ + public static MemorySegment __atanhf$address() { + return __atanhf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __atanhf(float __x) + * } + */ + public static float __atanhf(float __x) { + var mh$ = __atanhf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__atanhf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class expf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("expf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float expf(float __x) + * } + */ + public static FunctionDescriptor expf$descriptor() { + return expf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float expf(float __x) + * } + */ + public static MethodHandle expf$handle() { + return expf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float expf(float __x) + * } + */ + public static MemorySegment expf$address() { + return expf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float expf(float __x) + * } + */ + public static float expf(float __x) { + var mh$ = expf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("expf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __expf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__expf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __expf(float __x) + * } + */ + public static FunctionDescriptor __expf$descriptor() { + return __expf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __expf(float __x) + * } + */ + public static MethodHandle __expf$handle() { + return __expf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __expf(float __x) + * } + */ + public static MemorySegment __expf$address() { + return __expf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __expf(float __x) + * } + */ + public static float __expf(float __x) { + var mh$ = __expf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__expf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class frexpf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("frexpf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float frexpf(float __x, int *__exponent) + * } + */ + public static FunctionDescriptor frexpf$descriptor() { + return frexpf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float frexpf(float __x, int *__exponent) + * } + */ + public static MethodHandle frexpf$handle() { + return frexpf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float frexpf(float __x, int *__exponent) + * } + */ + public static MemorySegment frexpf$address() { + return frexpf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float frexpf(float __x, int *__exponent) + * } + */ + public static float frexpf(float __x, MemorySegment __exponent) { + var mh$ = frexpf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("frexpf", __x, __exponent); + } + return (float)mh$.invokeExact(__x, __exponent); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __frexpf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__frexpf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __frexpf(float __x, int *__exponent) + * } + */ + public static FunctionDescriptor __frexpf$descriptor() { + return __frexpf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __frexpf(float __x, int *__exponent) + * } + */ + public static MethodHandle __frexpf$handle() { + return __frexpf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __frexpf(float __x, int *__exponent) + * } + */ + public static MemorySegment __frexpf$address() { + return __frexpf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __frexpf(float __x, int *__exponent) + * } + */ + public static float __frexpf(float __x, MemorySegment __exponent) { + var mh$ = __frexpf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__frexpf", __x, __exponent); + } + return (float)mh$.invokeExact(__x, __exponent); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class ldexpf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("ldexpf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float ldexpf(float __x, int __exponent) + * } + */ + public static FunctionDescriptor ldexpf$descriptor() { + return ldexpf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float ldexpf(float __x, int __exponent) + * } + */ + public static MethodHandle ldexpf$handle() { + return ldexpf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float ldexpf(float __x, int __exponent) + * } + */ + public static MemorySegment ldexpf$address() { + return ldexpf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float ldexpf(float __x, int __exponent) + * } + */ + public static float ldexpf(float __x, int __exponent) { + var mh$ = ldexpf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("ldexpf", __x, __exponent); + } + return (float)mh$.invokeExact(__x, __exponent); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __ldexpf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__ldexpf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __ldexpf(float __x, int __exponent) + * } + */ + public static FunctionDescriptor __ldexpf$descriptor() { + return __ldexpf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __ldexpf(float __x, int __exponent) + * } + */ + public static MethodHandle __ldexpf$handle() { + return __ldexpf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __ldexpf(float __x, int __exponent) + * } + */ + public static MemorySegment __ldexpf$address() { + return __ldexpf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __ldexpf(float __x, int __exponent) + * } + */ + public static float __ldexpf(float __x, int __exponent) { + var mh$ = __ldexpf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__ldexpf", __x, __exponent); + } + return (float)mh$.invokeExact(__x, __exponent); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class logf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("logf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float logf(float __x) + * } + */ + public static FunctionDescriptor logf$descriptor() { + return logf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float logf(float __x) + * } + */ + public static MethodHandle logf$handle() { + return logf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float logf(float __x) + * } + */ + public static MemorySegment logf$address() { + return logf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float logf(float __x) + * } + */ + public static float logf(float __x) { + var mh$ = logf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("logf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __logf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__logf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __logf(float __x) + * } + */ + public static FunctionDescriptor __logf$descriptor() { + return __logf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __logf(float __x) + * } + */ + public static MethodHandle __logf$handle() { + return __logf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __logf(float __x) + * } + */ + public static MemorySegment __logf$address() { + return __logf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __logf(float __x) + * } + */ + public static float __logf(float __x) { + var mh$ = __logf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__logf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class log10f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("log10f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float log10f(float __x) + * } + */ + public static FunctionDescriptor log10f$descriptor() { + return log10f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float log10f(float __x) + * } + */ + public static MethodHandle log10f$handle() { + return log10f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float log10f(float __x) + * } + */ + public static MemorySegment log10f$address() { + return log10f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float log10f(float __x) + * } + */ + public static float log10f(float __x) { + var mh$ = log10f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("log10f", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __log10f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__log10f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __log10f(float __x) + * } + */ + public static FunctionDescriptor __log10f$descriptor() { + return __log10f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __log10f(float __x) + * } + */ + public static MethodHandle __log10f$handle() { + return __log10f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __log10f(float __x) + * } + */ + public static MemorySegment __log10f$address() { + return __log10f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __log10f(float __x) + * } + */ + public static float __log10f(float __x) { + var mh$ = __log10f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__log10f", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class modff { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("modff"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float modff(float __x, float *__iptr) + * } + */ + public static FunctionDescriptor modff$descriptor() { + return modff.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float modff(float __x, float *__iptr) + * } + */ + public static MethodHandle modff$handle() { + return modff.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float modff(float __x, float *__iptr) + * } + */ + public static MemorySegment modff$address() { + return modff.ADDR; + } + + /** + * {@snippet lang=c : + * extern float modff(float __x, float *__iptr) + * } + */ + public static float modff(float __x, MemorySegment __iptr) { + var mh$ = modff.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("modff", __x, __iptr); + } + return (float)mh$.invokeExact(__x, __iptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __modff { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__modff"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __modff(float __x, float *__iptr) + * } + */ + public static FunctionDescriptor __modff$descriptor() { + return __modff.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __modff(float __x, float *__iptr) + * } + */ + public static MethodHandle __modff$handle() { + return __modff.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __modff(float __x, float *__iptr) + * } + */ + public static MemorySegment __modff$address() { + return __modff.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __modff(float __x, float *__iptr) + * } + */ + public static float __modff(float __x, MemorySegment __iptr) { + var mh$ = __modff.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__modff", __x, __iptr); + } + return (float)mh$.invokeExact(__x, __iptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class expm1f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("expm1f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float expm1f(float __x) + * } + */ + public static FunctionDescriptor expm1f$descriptor() { + return expm1f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float expm1f(float __x) + * } + */ + public static MethodHandle expm1f$handle() { + return expm1f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float expm1f(float __x) + * } + */ + public static MemorySegment expm1f$address() { + return expm1f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float expm1f(float __x) + * } + */ + public static float expm1f(float __x) { + var mh$ = expm1f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("expm1f", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __expm1f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__expm1f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __expm1f(float __x) + * } + */ + public static FunctionDescriptor __expm1f$descriptor() { + return __expm1f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __expm1f(float __x) + * } + */ + public static MethodHandle __expm1f$handle() { + return __expm1f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __expm1f(float __x) + * } + */ + public static MemorySegment __expm1f$address() { + return __expm1f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __expm1f(float __x) + * } + */ + public static float __expm1f(float __x) { + var mh$ = __expm1f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__expm1f", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class log1pf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("log1pf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float log1pf(float __x) + * } + */ + public static FunctionDescriptor log1pf$descriptor() { + return log1pf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float log1pf(float __x) + * } + */ + public static MethodHandle log1pf$handle() { + return log1pf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float log1pf(float __x) + * } + */ + public static MemorySegment log1pf$address() { + return log1pf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float log1pf(float __x) + * } + */ + public static float log1pf(float __x) { + var mh$ = log1pf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("log1pf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __log1pf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__log1pf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __log1pf(float __x) + * } + */ + public static FunctionDescriptor __log1pf$descriptor() { + return __log1pf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __log1pf(float __x) + * } + */ + public static MethodHandle __log1pf$handle() { + return __log1pf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __log1pf(float __x) + * } + */ + public static MemorySegment __log1pf$address() { + return __log1pf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __log1pf(float __x) + * } + */ + public static float __log1pf(float __x) { + var mh$ = __log1pf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__log1pf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class logbf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("logbf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float logbf(float __x) + * } + */ + public static FunctionDescriptor logbf$descriptor() { + return logbf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float logbf(float __x) + * } + */ + public static MethodHandle logbf$handle() { + return logbf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float logbf(float __x) + * } + */ + public static MemorySegment logbf$address() { + return logbf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float logbf(float __x) + * } + */ + public static float logbf(float __x) { + var mh$ = logbf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("logbf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __logbf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__logbf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __logbf(float __x) + * } + */ + public static FunctionDescriptor __logbf$descriptor() { + return __logbf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __logbf(float __x) + * } + */ + public static MethodHandle __logbf$handle() { + return __logbf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __logbf(float __x) + * } + */ + public static MemorySegment __logbf$address() { + return __logbf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __logbf(float __x) + * } + */ + public static float __logbf(float __x) { + var mh$ = __logbf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__logbf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class exp2f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("exp2f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float exp2f(float __x) + * } + */ + public static FunctionDescriptor exp2f$descriptor() { + return exp2f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float exp2f(float __x) + * } + */ + public static MethodHandle exp2f$handle() { + return exp2f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float exp2f(float __x) + * } + */ + public static MemorySegment exp2f$address() { + return exp2f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float exp2f(float __x) + * } + */ + public static float exp2f(float __x) { + var mh$ = exp2f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("exp2f", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __exp2f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__exp2f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __exp2f(float __x) + * } + */ + public static FunctionDescriptor __exp2f$descriptor() { + return __exp2f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __exp2f(float __x) + * } + */ + public static MethodHandle __exp2f$handle() { + return __exp2f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __exp2f(float __x) + * } + */ + public static MemorySegment __exp2f$address() { + return __exp2f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __exp2f(float __x) + * } + */ + public static float __exp2f(float __x) { + var mh$ = __exp2f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__exp2f", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class log2f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("log2f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float log2f(float __x) + * } + */ + public static FunctionDescriptor log2f$descriptor() { + return log2f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float log2f(float __x) + * } + */ + public static MethodHandle log2f$handle() { + return log2f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float log2f(float __x) + * } + */ + public static MemorySegment log2f$address() { + return log2f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float log2f(float __x) + * } + */ + public static float log2f(float __x) { + var mh$ = log2f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("log2f", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __log2f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__log2f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __log2f(float __x) + * } + */ + public static FunctionDescriptor __log2f$descriptor() { + return __log2f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __log2f(float __x) + * } + */ + public static MethodHandle __log2f$handle() { + return __log2f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __log2f(float __x) + * } + */ + public static MemorySegment __log2f$address() { + return __log2f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __log2f(float __x) + * } + */ + public static float __log2f(float __x) { + var mh$ = __log2f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__log2f", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class powf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("powf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float powf(float __x, float __y) + * } + */ + public static FunctionDescriptor powf$descriptor() { + return powf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float powf(float __x, float __y) + * } + */ + public static MethodHandle powf$handle() { + return powf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float powf(float __x, float __y) + * } + */ + public static MemorySegment powf$address() { + return powf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float powf(float __x, float __y) + * } + */ + public static float powf(float __x, float __y) { + var mh$ = powf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("powf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __powf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__powf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __powf(float __x, float __y) + * } + */ + public static FunctionDescriptor __powf$descriptor() { + return __powf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __powf(float __x, float __y) + * } + */ + public static MethodHandle __powf$handle() { + return __powf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __powf(float __x, float __y) + * } + */ + public static MemorySegment __powf$address() { + return __powf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __powf(float __x, float __y) + * } + */ + public static float __powf(float __x, float __y) { + var mh$ = __powf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__powf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class sqrtf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("sqrtf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float sqrtf(float __x) + * } + */ + public static FunctionDescriptor sqrtf$descriptor() { + return sqrtf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float sqrtf(float __x) + * } + */ + public static MethodHandle sqrtf$handle() { + return sqrtf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float sqrtf(float __x) + * } + */ + public static MemorySegment sqrtf$address() { + return sqrtf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float sqrtf(float __x) + * } + */ + public static float sqrtf(float __x) { + var mh$ = sqrtf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("sqrtf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __sqrtf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__sqrtf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __sqrtf(float __x) + * } + */ + public static FunctionDescriptor __sqrtf$descriptor() { + return __sqrtf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __sqrtf(float __x) + * } + */ + public static MethodHandle __sqrtf$handle() { + return __sqrtf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __sqrtf(float __x) + * } + */ + public static MemorySegment __sqrtf$address() { + return __sqrtf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __sqrtf(float __x) + * } + */ + public static float __sqrtf(float __x) { + var mh$ = __sqrtf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__sqrtf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class hypotf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("hypotf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float hypotf(float __x, float __y) + * } + */ + public static FunctionDescriptor hypotf$descriptor() { + return hypotf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float hypotf(float __x, float __y) + * } + */ + public static MethodHandle hypotf$handle() { + return hypotf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float hypotf(float __x, float __y) + * } + */ + public static MemorySegment hypotf$address() { + return hypotf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float hypotf(float __x, float __y) + * } + */ + public static float hypotf(float __x, float __y) { + var mh$ = hypotf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("hypotf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __hypotf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__hypotf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __hypotf(float __x, float __y) + * } + */ + public static FunctionDescriptor __hypotf$descriptor() { + return __hypotf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __hypotf(float __x, float __y) + * } + */ + public static MethodHandle __hypotf$handle() { + return __hypotf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __hypotf(float __x, float __y) + * } + */ + public static MemorySegment __hypotf$address() { + return __hypotf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __hypotf(float __x, float __y) + * } + */ + public static float __hypotf(float __x, float __y) { + var mh$ = __hypotf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__hypotf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cbrtf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cbrtf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float cbrtf(float __x) + * } + */ + public static FunctionDescriptor cbrtf$descriptor() { + return cbrtf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float cbrtf(float __x) + * } + */ + public static MethodHandle cbrtf$handle() { + return cbrtf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float cbrtf(float __x) + * } + */ + public static MemorySegment cbrtf$address() { + return cbrtf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float cbrtf(float __x) + * } + */ + public static float cbrtf(float __x) { + var mh$ = cbrtf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cbrtf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __cbrtf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__cbrtf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __cbrtf(float __x) + * } + */ + public static FunctionDescriptor __cbrtf$descriptor() { + return __cbrtf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __cbrtf(float __x) + * } + */ + public static MethodHandle __cbrtf$handle() { + return __cbrtf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __cbrtf(float __x) + * } + */ + public static MemorySegment __cbrtf$address() { + return __cbrtf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __cbrtf(float __x) + * } + */ + public static float __cbrtf(float __x) { + var mh$ = __cbrtf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__cbrtf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class ceilf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("ceilf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float ceilf(float __x) + * } + */ + public static FunctionDescriptor ceilf$descriptor() { + return ceilf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float ceilf(float __x) + * } + */ + public static MethodHandle ceilf$handle() { + return ceilf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float ceilf(float __x) + * } + */ + public static MemorySegment ceilf$address() { + return ceilf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float ceilf(float __x) + * } + */ + public static float ceilf(float __x) { + var mh$ = ceilf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("ceilf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __ceilf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__ceilf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __ceilf(float __x) + * } + */ + public static FunctionDescriptor __ceilf$descriptor() { + return __ceilf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __ceilf(float __x) + * } + */ + public static MethodHandle __ceilf$handle() { + return __ceilf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __ceilf(float __x) + * } + */ + public static MemorySegment __ceilf$address() { + return __ceilf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __ceilf(float __x) + * } + */ + public static float __ceilf(float __x) { + var mh$ = __ceilf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__ceilf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fabsf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fabsf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float fabsf(float __x) + * } + */ + public static FunctionDescriptor fabsf$descriptor() { + return fabsf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float fabsf(float __x) + * } + */ + public static MethodHandle fabsf$handle() { + return fabsf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float fabsf(float __x) + * } + */ + public static MemorySegment fabsf$address() { + return fabsf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float fabsf(float __x) + * } + */ + public static float fabsf(float __x) { + var mh$ = fabsf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fabsf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fabsf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fabsf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __fabsf(float __x) + * } + */ + public static FunctionDescriptor __fabsf$descriptor() { + return __fabsf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __fabsf(float __x) + * } + */ + public static MethodHandle __fabsf$handle() { + return __fabsf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __fabsf(float __x) + * } + */ + public static MemorySegment __fabsf$address() { + return __fabsf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __fabsf(float __x) + * } + */ + public static float __fabsf(float __x) { + var mh$ = __fabsf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fabsf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class floorf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("floorf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float floorf(float __x) + * } + */ + public static FunctionDescriptor floorf$descriptor() { + return floorf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float floorf(float __x) + * } + */ + public static MethodHandle floorf$handle() { + return floorf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float floorf(float __x) + * } + */ + public static MemorySegment floorf$address() { + return floorf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float floorf(float __x) + * } + */ + public static float floorf(float __x) { + var mh$ = floorf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("floorf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __floorf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__floorf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __floorf(float __x) + * } + */ + public static FunctionDescriptor __floorf$descriptor() { + return __floorf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __floorf(float __x) + * } + */ + public static MethodHandle __floorf$handle() { + return __floorf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __floorf(float __x) + * } + */ + public static MemorySegment __floorf$address() { + return __floorf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __floorf(float __x) + * } + */ + public static float __floorf(float __x) { + var mh$ = __floorf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__floorf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fmodf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fmodf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float fmodf(float __x, float __y) + * } + */ + public static FunctionDescriptor fmodf$descriptor() { + return fmodf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float fmodf(float __x, float __y) + * } + */ + public static MethodHandle fmodf$handle() { + return fmodf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float fmodf(float __x, float __y) + * } + */ + public static MemorySegment fmodf$address() { + return fmodf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float fmodf(float __x, float __y) + * } + */ + public static float fmodf(float __x, float __y) { + var mh$ = fmodf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fmodf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fmodf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fmodf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __fmodf(float __x, float __y) + * } + */ + public static FunctionDescriptor __fmodf$descriptor() { + return __fmodf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __fmodf(float __x, float __y) + * } + */ + public static MethodHandle __fmodf$handle() { + return __fmodf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __fmodf(float __x, float __y) + * } + */ + public static MemorySegment __fmodf$address() { + return __fmodf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __fmodf(float __x, float __y) + * } + */ + public static float __fmodf(float __x, float __y) { + var mh$ = __fmodf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fmodf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class isinff { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("isinff"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int isinff(float __value) + * } + */ + public static FunctionDescriptor isinff$descriptor() { + return isinff.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int isinff(float __value) + * } + */ + public static MethodHandle isinff$handle() { + return isinff.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int isinff(float __value) + * } + */ + public static MemorySegment isinff$address() { + return isinff.ADDR; + } + + /** + * {@snippet lang=c : + * extern int isinff(float __value) + * } + */ + public static int isinff(float __value) { + var mh$ = isinff.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("isinff", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class finitef { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("finitef"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int finitef(float __value) + * } + */ + public static FunctionDescriptor finitef$descriptor() { + return finitef.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int finitef(float __value) + * } + */ + public static MethodHandle finitef$handle() { + return finitef.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int finitef(float __value) + * } + */ + public static MemorySegment finitef$address() { + return finitef.ADDR; + } + + /** + * {@snippet lang=c : + * extern int finitef(float __value) + * } + */ + public static int finitef(float __value) { + var mh$ = finitef.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("finitef", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class dremf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("dremf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float dremf(float __x, float __y) + * } + */ + public static FunctionDescriptor dremf$descriptor() { + return dremf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float dremf(float __x, float __y) + * } + */ + public static MethodHandle dremf$handle() { + return dremf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float dremf(float __x, float __y) + * } + */ + public static MemorySegment dremf$address() { + return dremf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float dremf(float __x, float __y) + * } + */ + public static float dremf(float __x, float __y) { + var mh$ = dremf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("dremf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __dremf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__dremf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __dremf(float __x, float __y) + * } + */ + public static FunctionDescriptor __dremf$descriptor() { + return __dremf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __dremf(float __x, float __y) + * } + */ + public static MethodHandle __dremf$handle() { + return __dremf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __dremf(float __x, float __y) + * } + */ + public static MemorySegment __dremf$address() { + return __dremf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __dremf(float __x, float __y) + * } + */ + public static float __dremf(float __x, float __y) { + var mh$ = __dremf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__dremf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class significandf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("significandf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float significandf(float __x) + * } + */ + public static FunctionDescriptor significandf$descriptor() { + return significandf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float significandf(float __x) + * } + */ + public static MethodHandle significandf$handle() { + return significandf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float significandf(float __x) + * } + */ + public static MemorySegment significandf$address() { + return significandf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float significandf(float __x) + * } + */ + public static float significandf(float __x) { + var mh$ = significandf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("significandf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __significandf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__significandf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __significandf(float __x) + * } + */ + public static FunctionDescriptor __significandf$descriptor() { + return __significandf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __significandf(float __x) + * } + */ + public static MethodHandle __significandf$handle() { + return __significandf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __significandf(float __x) + * } + */ + public static MemorySegment __significandf$address() { + return __significandf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __significandf(float __x) + * } + */ + public static float __significandf(float __x) { + var mh$ = __significandf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__significandf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class copysignf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("copysignf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float copysignf(float __x, float __y) + * } + */ + public static FunctionDescriptor copysignf$descriptor() { + return copysignf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float copysignf(float __x, float __y) + * } + */ + public static MethodHandle copysignf$handle() { + return copysignf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float copysignf(float __x, float __y) + * } + */ + public static MemorySegment copysignf$address() { + return copysignf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float copysignf(float __x, float __y) + * } + */ + public static float copysignf(float __x, float __y) { + var mh$ = copysignf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("copysignf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __copysignf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__copysignf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __copysignf(float __x, float __y) + * } + */ + public static FunctionDescriptor __copysignf$descriptor() { + return __copysignf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __copysignf(float __x, float __y) + * } + */ + public static MethodHandle __copysignf$handle() { + return __copysignf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __copysignf(float __x, float __y) + * } + */ + public static MemorySegment __copysignf$address() { + return __copysignf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __copysignf(float __x, float __y) + * } + */ + public static float __copysignf(float __x, float __y) { + var mh$ = __copysignf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__copysignf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class nanf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("nanf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float nanf(const char *__tagb) + * } + */ + public static FunctionDescriptor nanf$descriptor() { + return nanf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float nanf(const char *__tagb) + * } + */ + public static MethodHandle nanf$handle() { + return nanf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float nanf(const char *__tagb) + * } + */ + public static MemorySegment nanf$address() { + return nanf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float nanf(const char *__tagb) + * } + */ + public static float nanf(MemorySegment __tagb) { + var mh$ = nanf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("nanf", __tagb); + } + return (float)mh$.invokeExact(__tagb); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __nanf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__nanf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __nanf(const char *__tagb) + * } + */ + public static FunctionDescriptor __nanf$descriptor() { + return __nanf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __nanf(const char *__tagb) + * } + */ + public static MethodHandle __nanf$handle() { + return __nanf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __nanf(const char *__tagb) + * } + */ + public static MemorySegment __nanf$address() { + return __nanf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __nanf(const char *__tagb) + * } + */ + public static float __nanf(MemorySegment __tagb) { + var mh$ = __nanf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__nanf", __tagb); + } + return (float)mh$.invokeExact(__tagb); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class isnanf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("isnanf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int isnanf(float __value) + * } + */ + public static FunctionDescriptor isnanf$descriptor() { + return isnanf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int isnanf(float __value) + * } + */ + public static MethodHandle isnanf$handle() { + return isnanf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int isnanf(float __value) + * } + */ + public static MemorySegment isnanf$address() { + return isnanf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int isnanf(float __value) + * } + */ + public static int isnanf(float __value) { + var mh$ = isnanf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("isnanf", __value); + } + return (int)mh$.invokeExact(__value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class j0f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("j0f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float j0f(float) + * } + */ + public static FunctionDescriptor j0f$descriptor() { + return j0f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float j0f(float) + * } + */ + public static MethodHandle j0f$handle() { + return j0f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float j0f(float) + * } + */ + public static MemorySegment j0f$address() { + return j0f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float j0f(float) + * } + */ + public static float j0f(float x0) { + var mh$ = j0f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("j0f", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __j0f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__j0f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __j0f(float) + * } + */ + public static FunctionDescriptor __j0f$descriptor() { + return __j0f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __j0f(float) + * } + */ + public static MethodHandle __j0f$handle() { + return __j0f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __j0f(float) + * } + */ + public static MemorySegment __j0f$address() { + return __j0f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __j0f(float) + * } + */ + public static float __j0f(float x0) { + var mh$ = __j0f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__j0f", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class j1f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("j1f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float j1f(float) + * } + */ + public static FunctionDescriptor j1f$descriptor() { + return j1f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float j1f(float) + * } + */ + public static MethodHandle j1f$handle() { + return j1f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float j1f(float) + * } + */ + public static MemorySegment j1f$address() { + return j1f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float j1f(float) + * } + */ + public static float j1f(float x0) { + var mh$ = j1f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("j1f", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __j1f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__j1f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __j1f(float) + * } + */ + public static FunctionDescriptor __j1f$descriptor() { + return __j1f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __j1f(float) + * } + */ + public static MethodHandle __j1f$handle() { + return __j1f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __j1f(float) + * } + */ + public static MemorySegment __j1f$address() { + return __j1f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __j1f(float) + * } + */ + public static float __j1f(float x0) { + var mh$ = __j1f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__j1f", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class jnf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("jnf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float jnf(int, float) + * } + */ + public static FunctionDescriptor jnf$descriptor() { + return jnf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float jnf(int, float) + * } + */ + public static MethodHandle jnf$handle() { + return jnf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float jnf(int, float) + * } + */ + public static MemorySegment jnf$address() { + return jnf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float jnf(int, float) + * } + */ + public static float jnf(int x0, float x1) { + var mh$ = jnf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("jnf", x0, x1); + } + return (float)mh$.invokeExact(x0, x1); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __jnf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__jnf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __jnf(int, float) + * } + */ + public static FunctionDescriptor __jnf$descriptor() { + return __jnf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __jnf(int, float) + * } + */ + public static MethodHandle __jnf$handle() { + return __jnf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __jnf(int, float) + * } + */ + public static MemorySegment __jnf$address() { + return __jnf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __jnf(int, float) + * } + */ + public static float __jnf(int x0, float x1) { + var mh$ = __jnf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__jnf", x0, x1); + } + return (float)mh$.invokeExact(x0, x1); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class y0f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("y0f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float y0f(float) + * } + */ + public static FunctionDescriptor y0f$descriptor() { + return y0f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float y0f(float) + * } + */ + public static MethodHandle y0f$handle() { + return y0f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float y0f(float) + * } + */ + public static MemorySegment y0f$address() { + return y0f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float y0f(float) + * } + */ + public static float y0f(float x0) { + var mh$ = y0f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("y0f", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __y0f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__y0f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __y0f(float) + * } + */ + public static FunctionDescriptor __y0f$descriptor() { + return __y0f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __y0f(float) + * } + */ + public static MethodHandle __y0f$handle() { + return __y0f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __y0f(float) + * } + */ + public static MemorySegment __y0f$address() { + return __y0f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __y0f(float) + * } + */ + public static float __y0f(float x0) { + var mh$ = __y0f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__y0f", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class y1f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("y1f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float y1f(float) + * } + */ + public static FunctionDescriptor y1f$descriptor() { + return y1f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float y1f(float) + * } + */ + public static MethodHandle y1f$handle() { + return y1f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float y1f(float) + * } + */ + public static MemorySegment y1f$address() { + return y1f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float y1f(float) + * } + */ + public static float y1f(float x0) { + var mh$ = y1f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("y1f", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __y1f { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__y1f"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __y1f(float) + * } + */ + public static FunctionDescriptor __y1f$descriptor() { + return __y1f.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __y1f(float) + * } + */ + public static MethodHandle __y1f$handle() { + return __y1f.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __y1f(float) + * } + */ + public static MemorySegment __y1f$address() { + return __y1f.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __y1f(float) + * } + */ + public static float __y1f(float x0) { + var mh$ = __y1f.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__y1f", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class ynf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("ynf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float ynf(int, float) + * } + */ + public static FunctionDescriptor ynf$descriptor() { + return ynf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float ynf(int, float) + * } + */ + public static MethodHandle ynf$handle() { + return ynf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float ynf(int, float) + * } + */ + public static MemorySegment ynf$address() { + return ynf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float ynf(int, float) + * } + */ + public static float ynf(int x0, float x1) { + var mh$ = ynf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("ynf", x0, x1); + } + return (float)mh$.invokeExact(x0, x1); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __ynf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__ynf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __ynf(int, float) + * } + */ + public static FunctionDescriptor __ynf$descriptor() { + return __ynf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __ynf(int, float) + * } + */ + public static MethodHandle __ynf$handle() { + return __ynf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __ynf(int, float) + * } + */ + public static MemorySegment __ynf$address() { + return __ynf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __ynf(int, float) + * } + */ + public static float __ynf(int x0, float x1) { + var mh$ = __ynf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__ynf", x0, x1); + } + return (float)mh$.invokeExact(x0, x1); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class erff { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("erff"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float erff(float) + * } + */ + public static FunctionDescriptor erff$descriptor() { + return erff.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float erff(float) + * } + */ + public static MethodHandle erff$handle() { + return erff.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float erff(float) + * } + */ + public static MemorySegment erff$address() { + return erff.ADDR; + } + + /** + * {@snippet lang=c : + * extern float erff(float) + * } + */ + public static float erff(float x0) { + var mh$ = erff.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("erff", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __erff { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__erff"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __erff(float) + * } + */ + public static FunctionDescriptor __erff$descriptor() { + return __erff.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __erff(float) + * } + */ + public static MethodHandle __erff$handle() { + return __erff.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __erff(float) + * } + */ + public static MemorySegment __erff$address() { + return __erff.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __erff(float) + * } + */ + public static float __erff(float x0) { + var mh$ = __erff.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__erff", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class erfcf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("erfcf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float erfcf(float) + * } + */ + public static FunctionDescriptor erfcf$descriptor() { + return erfcf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float erfcf(float) + * } + */ + public static MethodHandle erfcf$handle() { + return erfcf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float erfcf(float) + * } + */ + public static MemorySegment erfcf$address() { + return erfcf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float erfcf(float) + * } + */ + public static float erfcf(float x0) { + var mh$ = erfcf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("erfcf", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __erfcf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__erfcf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __erfcf(float) + * } + */ + public static FunctionDescriptor __erfcf$descriptor() { + return __erfcf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __erfcf(float) + * } + */ + public static MethodHandle __erfcf$handle() { + return __erfcf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __erfcf(float) + * } + */ + public static MemorySegment __erfcf$address() { + return __erfcf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __erfcf(float) + * } + */ + public static float __erfcf(float x0) { + var mh$ = __erfcf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__erfcf", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class lgammaf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("lgammaf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float lgammaf(float) + * } + */ + public static FunctionDescriptor lgammaf$descriptor() { + return lgammaf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float lgammaf(float) + * } + */ + public static MethodHandle lgammaf$handle() { + return lgammaf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float lgammaf(float) + * } + */ + public static MemorySegment lgammaf$address() { + return lgammaf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float lgammaf(float) + * } + */ + public static float lgammaf(float x0) { + var mh$ = lgammaf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("lgammaf", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __lgammaf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__lgammaf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __lgammaf(float) + * } + */ + public static FunctionDescriptor __lgammaf$descriptor() { + return __lgammaf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __lgammaf(float) + * } + */ + public static MethodHandle __lgammaf$handle() { + return __lgammaf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __lgammaf(float) + * } + */ + public static MemorySegment __lgammaf$address() { + return __lgammaf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __lgammaf(float) + * } + */ + public static float __lgammaf(float x0) { + var mh$ = __lgammaf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__lgammaf", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class tgammaf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("tgammaf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float tgammaf(float) + * } + */ + public static FunctionDescriptor tgammaf$descriptor() { + return tgammaf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float tgammaf(float) + * } + */ + public static MethodHandle tgammaf$handle() { + return tgammaf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float tgammaf(float) + * } + */ + public static MemorySegment tgammaf$address() { + return tgammaf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float tgammaf(float) + * } + */ + public static float tgammaf(float x0) { + var mh$ = tgammaf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("tgammaf", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __tgammaf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__tgammaf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __tgammaf(float) + * } + */ + public static FunctionDescriptor __tgammaf$descriptor() { + return __tgammaf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __tgammaf(float) + * } + */ + public static MethodHandle __tgammaf$handle() { + return __tgammaf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __tgammaf(float) + * } + */ + public static MemorySegment __tgammaf$address() { + return __tgammaf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __tgammaf(float) + * } + */ + public static float __tgammaf(float x0) { + var mh$ = __tgammaf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__tgammaf", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class gammaf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("gammaf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float gammaf(float) + * } + */ + public static FunctionDescriptor gammaf$descriptor() { + return gammaf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float gammaf(float) + * } + */ + public static MethodHandle gammaf$handle() { + return gammaf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float gammaf(float) + * } + */ + public static MemorySegment gammaf$address() { + return gammaf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float gammaf(float) + * } + */ + public static float gammaf(float x0) { + var mh$ = gammaf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("gammaf", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __gammaf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__gammaf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __gammaf(float) + * } + */ + public static FunctionDescriptor __gammaf$descriptor() { + return __gammaf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __gammaf(float) + * } + */ + public static MethodHandle __gammaf$handle() { + return __gammaf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __gammaf(float) + * } + */ + public static MemorySegment __gammaf$address() { + return __gammaf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __gammaf(float) + * } + */ + public static float __gammaf(float x0) { + var mh$ = __gammaf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__gammaf", x0); + } + return (float)mh$.invokeExact(x0); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class lgammaf_r { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("lgammaf_r"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float lgammaf_r(float, int *__signgamp) + * } + */ + public static FunctionDescriptor lgammaf_r$descriptor() { + return lgammaf_r.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float lgammaf_r(float, int *__signgamp) + * } + */ + public static MethodHandle lgammaf_r$handle() { + return lgammaf_r.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float lgammaf_r(float, int *__signgamp) + * } + */ + public static MemorySegment lgammaf_r$address() { + return lgammaf_r.ADDR; + } + + /** + * {@snippet lang=c : + * extern float lgammaf_r(float, int *__signgamp) + * } + */ + public static float lgammaf_r(float x0, MemorySegment __signgamp) { + var mh$ = lgammaf_r.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("lgammaf_r", x0, __signgamp); + } + return (float)mh$.invokeExact(x0, __signgamp); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __lgammaf_r { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__lgammaf_r"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __lgammaf_r(float, int *__signgamp) + * } + */ + public static FunctionDescriptor __lgammaf_r$descriptor() { + return __lgammaf_r.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __lgammaf_r(float, int *__signgamp) + * } + */ + public static MethodHandle __lgammaf_r$handle() { + return __lgammaf_r.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __lgammaf_r(float, int *__signgamp) + * } + */ + public static MemorySegment __lgammaf_r$address() { + return __lgammaf_r.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __lgammaf_r(float, int *__signgamp) + * } + */ + public static float __lgammaf_r(float x0, MemorySegment __signgamp) { + var mh$ = __lgammaf_r.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__lgammaf_r", x0, __signgamp); + } + return (float)mh$.invokeExact(x0, __signgamp); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class rintf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("rintf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float rintf(float __x) + * } + */ + public static FunctionDescriptor rintf$descriptor() { + return rintf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float rintf(float __x) + * } + */ + public static MethodHandle rintf$handle() { + return rintf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float rintf(float __x) + * } + */ + public static MemorySegment rintf$address() { + return rintf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float rintf(float __x) + * } + */ + public static float rintf(float __x) { + var mh$ = rintf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("rintf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __rintf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__rintf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __rintf(float __x) + * } + */ + public static FunctionDescriptor __rintf$descriptor() { + return __rintf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __rintf(float __x) + * } + */ + public static MethodHandle __rintf$handle() { + return __rintf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __rintf(float __x) + * } + */ + public static MemorySegment __rintf$address() { + return __rintf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __rintf(float __x) + * } + */ + public static float __rintf(float __x) { + var mh$ = __rintf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__rintf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class nextafterf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("nextafterf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float nextafterf(float __x, float __y) + * } + */ + public static FunctionDescriptor nextafterf$descriptor() { + return nextafterf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float nextafterf(float __x, float __y) + * } + */ + public static MethodHandle nextafterf$handle() { + return nextafterf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float nextafterf(float __x, float __y) + * } + */ + public static MemorySegment nextafterf$address() { + return nextafterf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float nextafterf(float __x, float __y) + * } + */ + public static float nextafterf(float __x, float __y) { + var mh$ = nextafterf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("nextafterf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __nextafterf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__nextafterf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __nextafterf(float __x, float __y) + * } + */ + public static FunctionDescriptor __nextafterf$descriptor() { + return __nextafterf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __nextafterf(float __x, float __y) + * } + */ + public static MethodHandle __nextafterf$handle() { + return __nextafterf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __nextafterf(float __x, float __y) + * } + */ + public static MemorySegment __nextafterf$address() { + return __nextafterf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __nextafterf(float __x, float __y) + * } + */ + public static float __nextafterf(float __x, float __y) { + var mh$ = __nextafterf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__nextafterf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class remainderf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("remainderf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float remainderf(float __x, float __y) + * } + */ + public static FunctionDescriptor remainderf$descriptor() { + return remainderf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float remainderf(float __x, float __y) + * } + */ + public static MethodHandle remainderf$handle() { + return remainderf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float remainderf(float __x, float __y) + * } + */ + public static MemorySegment remainderf$address() { + return remainderf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float remainderf(float __x, float __y) + * } + */ + public static float remainderf(float __x, float __y) { + var mh$ = remainderf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("remainderf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __remainderf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__remainderf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __remainderf(float __x, float __y) + * } + */ + public static FunctionDescriptor __remainderf$descriptor() { + return __remainderf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __remainderf(float __x, float __y) + * } + */ + public static MethodHandle __remainderf$handle() { + return __remainderf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __remainderf(float __x, float __y) + * } + */ + public static MemorySegment __remainderf$address() { + return __remainderf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __remainderf(float __x, float __y) + * } + */ + public static float __remainderf(float __x, float __y) { + var mh$ = __remainderf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__remainderf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class scalbnf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("scalbnf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float scalbnf(float __x, int __n) + * } + */ + public static FunctionDescriptor scalbnf$descriptor() { + return scalbnf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float scalbnf(float __x, int __n) + * } + */ + public static MethodHandle scalbnf$handle() { + return scalbnf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float scalbnf(float __x, int __n) + * } + */ + public static MemorySegment scalbnf$address() { + return scalbnf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float scalbnf(float __x, int __n) + * } + */ + public static float scalbnf(float __x, int __n) { + var mh$ = scalbnf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("scalbnf", __x, __n); + } + return (float)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __scalbnf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__scalbnf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __scalbnf(float __x, int __n) + * } + */ + public static FunctionDescriptor __scalbnf$descriptor() { + return __scalbnf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __scalbnf(float __x, int __n) + * } + */ + public static MethodHandle __scalbnf$handle() { + return __scalbnf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __scalbnf(float __x, int __n) + * } + */ + public static MemorySegment __scalbnf$address() { + return __scalbnf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __scalbnf(float __x, int __n) + * } + */ + public static float __scalbnf(float __x, int __n) { + var mh$ = __scalbnf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__scalbnf", __x, __n); + } + return (float)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class ilogbf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("ilogbf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int ilogbf(float __x) + * } + */ + public static FunctionDescriptor ilogbf$descriptor() { + return ilogbf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int ilogbf(float __x) + * } + */ + public static MethodHandle ilogbf$handle() { + return ilogbf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int ilogbf(float __x) + * } + */ + public static MemorySegment ilogbf$address() { + return ilogbf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int ilogbf(float __x) + * } + */ + public static int ilogbf(float __x) { + var mh$ = ilogbf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("ilogbf", __x); + } + return (int)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __ilogbf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__ilogbf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern int __ilogbf(float __x) + * } + */ + public static FunctionDescriptor __ilogbf$descriptor() { + return __ilogbf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern int __ilogbf(float __x) + * } + */ + public static MethodHandle __ilogbf$handle() { + return __ilogbf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern int __ilogbf(float __x) + * } + */ + public static MemorySegment __ilogbf$address() { + return __ilogbf.ADDR; + } + + /** + * {@snippet lang=c : + * extern int __ilogbf(float __x) + * } + */ + public static int __ilogbf(float __x) { + var mh$ = __ilogbf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__ilogbf", __x); + } + return (int)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class scalblnf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_LONG + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("scalblnf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float scalblnf(float __x, long __n) + * } + */ + public static FunctionDescriptor scalblnf$descriptor() { + return scalblnf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float scalblnf(float __x, long __n) + * } + */ + public static MethodHandle scalblnf$handle() { + return scalblnf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float scalblnf(float __x, long __n) + * } + */ + public static MemorySegment scalblnf$address() { + return scalblnf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float scalblnf(float __x, long __n) + * } + */ + public static float scalblnf(float __x, long __n) { + var mh$ = scalblnf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("scalblnf", __x, __n); + } + return (float)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __scalblnf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_LONG + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__scalblnf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __scalblnf(float __x, long __n) + * } + */ + public static FunctionDescriptor __scalblnf$descriptor() { + return __scalblnf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __scalblnf(float __x, long __n) + * } + */ + public static MethodHandle __scalblnf$handle() { + return __scalblnf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __scalblnf(float __x, long __n) + * } + */ + public static MemorySegment __scalblnf$address() { + return __scalblnf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __scalblnf(float __x, long __n) + * } + */ + public static float __scalblnf(float __x, long __n) { + var mh$ = __scalblnf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__scalblnf", __x, __n); + } + return (float)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class nearbyintf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("nearbyintf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float nearbyintf(float __x) + * } + */ + public static FunctionDescriptor nearbyintf$descriptor() { + return nearbyintf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float nearbyintf(float __x) + * } + */ + public static MethodHandle nearbyintf$handle() { + return nearbyintf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float nearbyintf(float __x) + * } + */ + public static MemorySegment nearbyintf$address() { + return nearbyintf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float nearbyintf(float __x) + * } + */ + public static float nearbyintf(float __x) { + var mh$ = nearbyintf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("nearbyintf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __nearbyintf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__nearbyintf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __nearbyintf(float __x) + * } + */ + public static FunctionDescriptor __nearbyintf$descriptor() { + return __nearbyintf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __nearbyintf(float __x) + * } + */ + public static MethodHandle __nearbyintf$handle() { + return __nearbyintf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __nearbyintf(float __x) + * } + */ + public static MemorySegment __nearbyintf$address() { + return __nearbyintf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __nearbyintf(float __x) + * } + */ + public static float __nearbyintf(float __x) { + var mh$ = __nearbyintf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__nearbyintf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class roundf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("roundf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float roundf(float __x) + * } + */ + public static FunctionDescriptor roundf$descriptor() { + return roundf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float roundf(float __x) + * } + */ + public static MethodHandle roundf$handle() { + return roundf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float roundf(float __x) + * } + */ + public static MemorySegment roundf$address() { + return roundf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float roundf(float __x) + * } + */ + public static float roundf(float __x) { + var mh$ = roundf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("roundf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __roundf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__roundf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __roundf(float __x) + * } + */ + public static FunctionDescriptor __roundf$descriptor() { + return __roundf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __roundf(float __x) + * } + */ + public static MethodHandle __roundf$handle() { + return __roundf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __roundf(float __x) + * } + */ + public static MemorySegment __roundf$address() { + return __roundf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __roundf(float __x) + * } + */ + public static float __roundf(float __x) { + var mh$ = __roundf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__roundf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class truncf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("truncf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float truncf(float __x) + * } + */ + public static FunctionDescriptor truncf$descriptor() { + return truncf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float truncf(float __x) + * } + */ + public static MethodHandle truncf$handle() { + return truncf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float truncf(float __x) + * } + */ + public static MemorySegment truncf$address() { + return truncf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float truncf(float __x) + * } + */ + public static float truncf(float __x) { + var mh$ = truncf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("truncf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __truncf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__truncf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __truncf(float __x) + * } + */ + public static FunctionDescriptor __truncf$descriptor() { + return __truncf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __truncf(float __x) + * } + */ + public static MethodHandle __truncf$handle() { + return __truncf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __truncf(float __x) + * } + */ + public static MemorySegment __truncf$address() { + return __truncf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __truncf(float __x) + * } + */ + public static float __truncf(float __x) { + var mh$ = __truncf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__truncf", __x); + } + return (float)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class remquof { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("remquof"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float remquof(float __x, float __y, int *__quo) + * } + */ + public static FunctionDescriptor remquof$descriptor() { + return remquof.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float remquof(float __x, float __y, int *__quo) + * } + */ + public static MethodHandle remquof$handle() { + return remquof.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float remquof(float __x, float __y, int *__quo) + * } + */ + public static MemorySegment remquof$address() { + return remquof.ADDR; + } + + /** + * {@snippet lang=c : + * extern float remquof(float __x, float __y, int *__quo) + * } + */ + public static float remquof(float __x, float __y, MemorySegment __quo) { + var mh$ = remquof.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("remquof", __x, __y, __quo); + } + return (float)mh$.invokeExact(__x, __y, __quo); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __remquof { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__remquof"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __remquof(float __x, float __y, int *__quo) + * } + */ + public static FunctionDescriptor __remquof$descriptor() { + return __remquof.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __remquof(float __x, float __y, int *__quo) + * } + */ + public static MethodHandle __remquof$handle() { + return __remquof.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __remquof(float __x, float __y, int *__quo) + * } + */ + public static MemorySegment __remquof$address() { + return __remquof.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __remquof(float __x, float __y, int *__quo) + * } + */ + public static float __remquof(float __x, float __y, MemorySegment __quo) { + var mh$ = __remquof.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__remquof", __x, __y, __quo); + } + return (float)mh$.invokeExact(__x, __y, __quo); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class lrintf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("lrintf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long lrintf(float __x) + * } + */ + public static FunctionDescriptor lrintf$descriptor() { + return lrintf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long lrintf(float __x) + * } + */ + public static MethodHandle lrintf$handle() { + return lrintf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long lrintf(float __x) + * } + */ + public static MemorySegment lrintf$address() { + return lrintf.ADDR; + } + + /** + * {@snippet lang=c : + * extern long lrintf(float __x) + * } + */ + public static long lrintf(float __x) { + var mh$ = lrintf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("lrintf", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __lrintf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__lrintf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long __lrintf(float __x) + * } + */ + public static FunctionDescriptor __lrintf$descriptor() { + return __lrintf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long __lrintf(float __x) + * } + */ + public static MethodHandle __lrintf$handle() { + return __lrintf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long __lrintf(float __x) + * } + */ + public static MemorySegment __lrintf$address() { + return __lrintf.ADDR; + } + + /** + * {@snippet lang=c : + * extern long __lrintf(float __x) + * } + */ + public static long __lrintf(float __x) { + var mh$ = __lrintf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__lrintf", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class llrintf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG_LONG, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("llrintf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long long llrintf(float __x) + * } + */ + public static FunctionDescriptor llrintf$descriptor() { + return llrintf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long long llrintf(float __x) + * } + */ + public static MethodHandle llrintf$handle() { + return llrintf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long long llrintf(float __x) + * } + */ + public static MemorySegment llrintf$address() { + return llrintf.ADDR; + } + + /** + * {@snippet lang=c : + * extern long long llrintf(float __x) + * } + */ + public static long llrintf(float __x) { + var mh$ = llrintf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("llrintf", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __llrintf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG_LONG, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__llrintf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long long __llrintf(float __x) + * } + */ + public static FunctionDescriptor __llrintf$descriptor() { + return __llrintf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long long __llrintf(float __x) + * } + */ + public static MethodHandle __llrintf$handle() { + return __llrintf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long long __llrintf(float __x) + * } + */ + public static MemorySegment __llrintf$address() { + return __llrintf.ADDR; + } + + /** + * {@snippet lang=c : + * extern long long __llrintf(float __x) + * } + */ + public static long __llrintf(float __x) { + var mh$ = __llrintf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__llrintf", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class lroundf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("lroundf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long lroundf(float __x) + * } + */ + public static FunctionDescriptor lroundf$descriptor() { + return lroundf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long lroundf(float __x) + * } + */ + public static MethodHandle lroundf$handle() { + return lroundf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long lroundf(float __x) + * } + */ + public static MemorySegment lroundf$address() { + return lroundf.ADDR; + } + + /** + * {@snippet lang=c : + * extern long lroundf(float __x) + * } + */ + public static long lroundf(float __x) { + var mh$ = lroundf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("lroundf", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __lroundf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__lroundf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long __lroundf(float __x) + * } + */ + public static FunctionDescriptor __lroundf$descriptor() { + return __lroundf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long __lroundf(float __x) + * } + */ + public static MethodHandle __lroundf$handle() { + return __lroundf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long __lroundf(float __x) + * } + */ + public static MemorySegment __lroundf$address() { + return __lroundf.ADDR; + } + + /** + * {@snippet lang=c : + * extern long __lroundf(float __x) + * } + */ + public static long __lroundf(float __x) { + var mh$ = __lroundf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__lroundf", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class llroundf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG_LONG, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("llroundf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long long llroundf(float __x) + * } + */ + public static FunctionDescriptor llroundf$descriptor() { + return llroundf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long long llroundf(float __x) + * } + */ + public static MethodHandle llroundf$handle() { + return llroundf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long long llroundf(float __x) + * } + */ + public static MemorySegment llroundf$address() { + return llroundf.ADDR; + } + + /** + * {@snippet lang=c : + * extern long long llroundf(float __x) + * } + */ + public static long llroundf(float __x) { + var mh$ = llroundf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("llroundf", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __llroundf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_LONG_LONG, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__llroundf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern long long __llroundf(float __x) + * } + */ + public static FunctionDescriptor __llroundf$descriptor() { + return __llroundf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern long long __llroundf(float __x) + * } + */ + public static MethodHandle __llroundf$handle() { + return __llroundf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern long long __llroundf(float __x) + * } + */ + public static MemorySegment __llroundf$address() { + return __llroundf.ADDR; + } + + /** + * {@snippet lang=c : + * extern long long __llroundf(float __x) + * } + */ + public static long __llroundf(float __x) { + var mh$ = __llroundf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__llroundf", __x); + } + return (long)mh$.invokeExact(__x); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fdimf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fdimf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float fdimf(float __x, float __y) + * } + */ + public static FunctionDescriptor fdimf$descriptor() { + return fdimf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float fdimf(float __x, float __y) + * } + */ + public static MethodHandle fdimf$handle() { + return fdimf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float fdimf(float __x, float __y) + * } + */ + public static MemorySegment fdimf$address() { + return fdimf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float fdimf(float __x, float __y) + * } + */ + public static float fdimf(float __x, float __y) { + var mh$ = fdimf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fdimf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fdimf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fdimf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __fdimf(float __x, float __y) + * } + */ + public static FunctionDescriptor __fdimf$descriptor() { + return __fdimf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __fdimf(float __x, float __y) + * } + */ + public static MethodHandle __fdimf$handle() { + return __fdimf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __fdimf(float __x, float __y) + * } + */ + public static MemorySegment __fdimf$address() { + return __fdimf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __fdimf(float __x, float __y) + * } + */ + public static float __fdimf(float __x, float __y) { + var mh$ = __fdimf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fdimf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fmaxf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fmaxf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float fmaxf(float __x, float __y) + * } + */ + public static FunctionDescriptor fmaxf$descriptor() { + return fmaxf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float fmaxf(float __x, float __y) + * } + */ + public static MethodHandle fmaxf$handle() { + return fmaxf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float fmaxf(float __x, float __y) + * } + */ + public static MemorySegment fmaxf$address() { + return fmaxf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float fmaxf(float __x, float __y) + * } + */ + public static float fmaxf(float __x, float __y) { + var mh$ = fmaxf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fmaxf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fmaxf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fmaxf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __fmaxf(float __x, float __y) + * } + */ + public static FunctionDescriptor __fmaxf$descriptor() { + return __fmaxf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __fmaxf(float __x, float __y) + * } + */ + public static MethodHandle __fmaxf$handle() { + return __fmaxf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __fmaxf(float __x, float __y) + * } + */ + public static MemorySegment __fmaxf$address() { + return __fmaxf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __fmaxf(float __x, float __y) + * } + */ + public static float __fmaxf(float __x, float __y) { + var mh$ = __fmaxf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fmaxf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fminf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fminf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float fminf(float __x, float __y) + * } + */ + public static FunctionDescriptor fminf$descriptor() { + return fminf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float fminf(float __x, float __y) + * } + */ + public static MethodHandle fminf$handle() { + return fminf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float fminf(float __x, float __y) + * } + */ + public static MemorySegment fminf$address() { + return fminf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float fminf(float __x, float __y) + * } + */ + public static float fminf(float __x, float __y) { + var mh$ = fminf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fminf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fminf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fminf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __fminf(float __x, float __y) + * } + */ + public static FunctionDescriptor __fminf$descriptor() { + return __fminf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __fminf(float __x, float __y) + * } + */ + public static MethodHandle __fminf$handle() { + return __fminf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __fminf(float __x, float __y) + * } + */ + public static MemorySegment __fminf$address() { + return __fminf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __fminf(float __x, float __y) + * } + */ + public static float __fminf(float __x, float __y) { + var mh$ = __fminf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fminf", __x, __y); + } + return (float)mh$.invokeExact(__x, __y); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fmaf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("fmaf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float fmaf(float __x, float __y, float __z) + * } + */ + public static FunctionDescriptor fmaf$descriptor() { + return fmaf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float fmaf(float __x, float __y, float __z) + * } + */ + public static MethodHandle fmaf$handle() { + return fmaf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float fmaf(float __x, float __y, float __z) + * } + */ + public static MemorySegment fmaf$address() { + return fmaf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float fmaf(float __x, float __y, float __z) + * } + */ + public static float fmaf(float __x, float __y, float __z) { + var mh$ = fmaf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fmaf", __x, __y, __z); + } + return (float)mh$.invokeExact(__x, __y, __z); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __fmaf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__fmaf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __fmaf(float __x, float __y, float __z) + * } + */ + public static FunctionDescriptor __fmaf$descriptor() { + return __fmaf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __fmaf(float __x, float __y, float __z) + * } + */ + public static MethodHandle __fmaf$handle() { + return __fmaf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __fmaf(float __x, float __y, float __z) + * } + */ + public static MemorySegment __fmaf$address() { + return __fmaf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __fmaf(float __x, float __y, float __z) + * } + */ + public static float __fmaf(float __x, float __y, float __z) { + var mh$ = __fmaf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__fmaf", __x, __y, __z); + } + return (float)mh$.invokeExact(__x, __y, __z); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class scalbf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("scalbf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float scalbf(float __x, float __n) + * } + */ + public static FunctionDescriptor scalbf$descriptor() { + return scalbf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float scalbf(float __x, float __n) + * } + */ + public static MethodHandle scalbf$handle() { + return scalbf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float scalbf(float __x, float __n) + * } + */ + public static MemorySegment scalbf$address() { + return scalbf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float scalbf(float __x, float __n) + * } + */ + public static float scalbf(float __x, float __n) { + var mh$ = scalbf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("scalbf", __x, __n); + } + return (float)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class __scalbf { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT, + cuopt_c_h.C_FLOAT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("__scalbf"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * extern float __scalbf(float __x, float __n) + * } + */ + public static FunctionDescriptor __scalbf$descriptor() { + return __scalbf.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * extern float __scalbf(float __x, float __n) + * } + */ + public static MethodHandle __scalbf$handle() { + return __scalbf.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * extern float __scalbf(float __x, float __n) + * } + */ + public static MemorySegment __scalbf$address() { + return __scalbf.ADDR; + } + + /** + * {@snippet lang=c : + * extern float __scalbf(float __x, float __n) + * } + */ + public static float __scalbf(float __x, float __n) { + var mh$ = __scalbf.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("__scalbf", __x, __n); + } + return (float)mh$.invokeExact(__x, __n); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class signgam$constants { + public static final OfInt LAYOUT = cuopt_c_h.C_INT; + public static final MemorySegment SEGMENT = cuopt_c_h.findOrThrow("signgam").reinterpret(LAYOUT.byteSize()); + } + + /** + * Layout for variable: + * {@snippet lang=c : + * extern int signgam + * } + */ + public static OfInt signgam$layout() { + return signgam$constants.LAYOUT; + } + + /** + * Segment for variable: + * {@snippet lang=c : + * extern int signgam + * } + */ + public static MemorySegment signgam$segment() { + return signgam$constants.SEGMENT; + } + + /** + * Getter for variable: + * {@snippet lang=c : + * extern int signgam + * } + */ + public static int signgam() { + return signgam$constants.SEGMENT.get(signgam$constants.LAYOUT, 0L); + } + + /** + * Setter for variable: + * {@snippet lang=c : + * extern int signgam + * } + */ + public static void signgam(int varValue) { + signgam$constants.SEGMENT.set(signgam$constants.LAYOUT, 0L, varValue); + } + /** + * {@snippet lang=c : + * typedef __int8_t int8_t + * } + */ + public static final OfByte int8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef __int16_t int16_t + * } + */ + public static final OfShort int16_t = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef __int32_t int32_t + * } + */ + public static final OfInt int32_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef __int64_t int64_t + * } + */ + public static final OfLong int64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef __uint8_t uint8_t + * } + */ + public static final OfByte uint8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef __uint16_t uint16_t + * } + */ + public static final OfShort uint16_t = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef __uint32_t uint32_t + * } + */ + public static final OfInt uint32_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef __uint64_t uint64_t + * } + */ + public static final OfLong uint64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef __int_least8_t int_least8_t + * } + */ + public static final OfByte int_least8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef __int_least16_t int_least16_t + * } + */ + public static final OfShort int_least16_t = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef __int_least32_t int_least32_t + * } + */ + public static final OfInt int_least32_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef __int_least64_t int_least64_t + * } + */ + public static final OfLong int_least64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef __uint_least8_t uint_least8_t + * } + */ + public static final OfByte uint_least8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef __uint_least16_t uint_least16_t + * } + */ + public static final OfShort uint_least16_t = cuopt_c_h.C_SHORT; + /** + * {@snippet lang=c : + * typedef __uint_least32_t uint_least32_t + * } + */ + public static final OfInt uint_least32_t = cuopt_c_h.C_INT; + /** + * {@snippet lang=c : + * typedef __uint_least64_t uint_least64_t + * } + */ + public static final OfLong uint_least64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef signed char int_fast8_t + * } + */ + public static final OfByte int_fast8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef long int_fast16_t + * } + */ + public static final OfLong int_fast16_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long int_fast32_t + * } + */ + public static final OfLong int_fast32_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long int_fast64_t + * } + */ + public static final OfLong int_fast64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned char uint_fast8_t + * } + */ + public static final OfByte uint_fast8_t = cuopt_c_h.C_CHAR; + /** + * {@snippet lang=c : + * typedef unsigned long uint_fast16_t + * } + */ + public static final OfLong uint_fast16_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long uint_fast32_t + * } + */ + public static final OfLong uint_fast32_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long uint_fast64_t + * } + */ + public static final OfLong uint_fast64_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef long intptr_t + * } + */ + public static final OfLong intptr_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef unsigned long uintptr_t + * } + */ + public static final OfLong uintptr_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef __intmax_t intmax_t + * } + */ + public static final OfLong intmax_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef __uintmax_t uintmax_t + * } + */ + public static final OfLong uintmax_t = cuopt_c_h.C_LONG; + /** + * {@snippet lang=c : + * typedef void *cuOptOptimizationProblem + * } + */ + public static final AddressLayout cuOptOptimizationProblem = cuopt_c_h.C_POINTER; + /** + * {@snippet lang=c : + * typedef void *cuOptSolverSettings + * } + */ + public static final AddressLayout cuOptSolverSettings = cuopt_c_h.C_POINTER; + /** + * {@snippet lang=c : + * typedef void *cuOptSolution + * } + */ + public static final AddressLayout cuOptSolution = cuopt_c_h.C_POINTER; + /** + * {@snippet lang=c : + * typedef double cuopt_float_t + * } + */ + public static final OfDouble cuopt_float_t = cuopt_c_h.C_DOUBLE; + /** + * {@snippet lang=c : + * typedef int32_t cuopt_int_t + * } + */ + public static final OfInt cuopt_int_t = cuopt_c_h.C_INT; + + /** + * Variadic invoker class for: + * {@snippet lang=c : + * int8_t cuOptGetFloatSize() + * } + */ + public static class cuOptGetFloatSize { + private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( + cuopt_c_h.C_CHAR ); + private static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetFloatSize"); + + private final MethodHandle handle; + private final FunctionDescriptor descriptor; + private final MethodHandle spreader; + + private cuOptGetFloatSize(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { + this.handle = handle; + this.descriptor = descriptor; + this.spreader = spreader; + } + + /** + * Variadic invoker factory for: + * {@snippet lang=c : + * int8_t cuOptGetFloatSize() + * } + */ + public static cuOptGetFloatSize makeInvoker(MemoryLayout... layouts) { + FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); + Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); + var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); + var spreader$ = mh$.asSpreader(Object[].class, layouts.length); + return new cuOptGetFloatSize(mh$, desc$, spreader$); + } + + /** + * {@return the address} + */ + public static MemorySegment address() { + return ADDR; + } + + /** + * {@return the specialized method handle} + */ + public MethodHandle handle() { + return handle; + } + + /** + * {@return the specialized descriptor} + */ + public FunctionDescriptor descriptor() { + return descriptor; + } + + public byte apply(Object... x0) { + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetFloatSize", x0); + } + return (byte) spreader.invokeExact(x0); + } catch(IllegalArgumentException | ClassCastException ex$) { + throw ex$; // rethrow IAE from passing wrong number/type of args + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + } + + /** + * Variadic invoker class for: + * {@snippet lang=c : + * int8_t cuOptGetIntSize() + * } + */ + public static class cuOptGetIntSize { + private static final FunctionDescriptor BASE_DESC = FunctionDescriptor.of( + cuopt_c_h.C_CHAR ); + private static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetIntSize"); + + private final MethodHandle handle; + private final FunctionDescriptor descriptor; + private final MethodHandle spreader; + + private cuOptGetIntSize(MethodHandle handle, FunctionDescriptor descriptor, MethodHandle spreader) { + this.handle = handle; + this.descriptor = descriptor; + this.spreader = spreader; + } + + /** + * Variadic invoker factory for: + * {@snippet lang=c : + * int8_t cuOptGetIntSize() + * } + */ + public static cuOptGetIntSize makeInvoker(MemoryLayout... layouts) { + FunctionDescriptor desc$ = BASE_DESC.appendArgumentLayouts(layouts); + Linker.Option fva$ = Linker.Option.firstVariadicArg(BASE_DESC.argumentLayouts().size()); + var mh$ = Linker.nativeLinker().downcallHandle(ADDR, desc$, fva$); + var spreader$ = mh$.asSpreader(Object[].class, layouts.length); + return new cuOptGetIntSize(mh$, desc$, spreader$); + } + + /** + * {@return the address} + */ + public static MemorySegment address() { + return ADDR; + } + + /** + * {@return the specialized method handle} + */ + public MethodHandle handle() { + return handle; + } + + /** + * {@return the specialized descriptor} + */ + public FunctionDescriptor descriptor() { + return descriptor; + } + + public byte apply(Object... x0) { + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetIntSize", x0); + } + return (byte) spreader.invokeExact(x0); + } catch(IllegalArgumentException | ClassCastException ex$) { + throw ex$; // rethrow IAE from passing wrong number/type of args + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + } + + private static class cuOptGetVersion { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetVersion"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVersion(cuopt_int_t *version_major, cuopt_int_t *version_minor, cuopt_int_t *version_patch) + * } + */ + public static FunctionDescriptor cuOptGetVersion$descriptor() { + return cuOptGetVersion.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVersion(cuopt_int_t *version_major, cuopt_int_t *version_minor, cuopt_int_t *version_patch) + * } + */ + public static MethodHandle cuOptGetVersion$handle() { + return cuOptGetVersion.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVersion(cuopt_int_t *version_major, cuopt_int_t *version_minor, cuopt_int_t *version_patch) + * } + */ + public static MemorySegment cuOptGetVersion$address() { + return cuOptGetVersion.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetVersion(cuopt_int_t *version_major, cuopt_int_t *version_minor, cuopt_int_t *version_patch) + * } + */ + public static int cuOptGetVersion(MemorySegment version_major, MemorySegment version_minor, MemorySegment version_patch) { + var mh$ = cuOptGetVersion.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetVersion", version_major, version_minor, version_patch); + } + return (int)mh$.invokeExact(version_major, version_minor, version_patch); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptReadProblem { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptReadProblem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptReadProblem(const char *filename, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static FunctionDescriptor cuOptReadProblem$descriptor() { + return cuOptReadProblem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptReadProblem(const char *filename, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MethodHandle cuOptReadProblem$handle() { + return cuOptReadProblem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptReadProblem(const char *filename, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MemorySegment cuOptReadProblem$address() { + return cuOptReadProblem.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptReadProblem(const char *filename, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static int cuOptReadProblem(MemorySegment filename, MemorySegment problem_ptr) { + var mh$ = cuOptReadProblem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptReadProblem", filename, problem_ptr); + } + return (int)mh$.invokeExact(filename, problem_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptWriteProblem { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptWriteProblem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptWriteProblem(cuOptOptimizationProblem problem, const char *filename, cuopt_int_t format) + * } + */ + public static FunctionDescriptor cuOptWriteProblem$descriptor() { + return cuOptWriteProblem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptWriteProblem(cuOptOptimizationProblem problem, const char *filename, cuopt_int_t format) + * } + */ + public static MethodHandle cuOptWriteProblem$handle() { + return cuOptWriteProblem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptWriteProblem(cuOptOptimizationProblem problem, const char *filename, cuopt_int_t format) + * } + */ + public static MemorySegment cuOptWriteProblem$address() { + return cuOptWriteProblem.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptWriteProblem(cuOptOptimizationProblem problem, const char *filename, cuopt_int_t format) + * } + */ + public static int cuOptWriteProblem(MemorySegment problem, MemorySegment filename, int format) { + var mh$ = cuOptWriteProblem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptWriteProblem", problem, filename, format); + } + return (int)mh$.invokeExact(problem, filename, format); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptCreateProblem { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptCreateProblem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficent_values, const char *constraint_sense, const cuopt_float_t *rhs, const cuopt_float_t *lower_bounds, const cuopt_float_t *upper_bounds, const char *variable_types, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static FunctionDescriptor cuOptCreateProblem$descriptor() { + return cuOptCreateProblem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficent_values, const char *constraint_sense, const cuopt_float_t *rhs, const cuopt_float_t *lower_bounds, const cuopt_float_t *upper_bounds, const char *variable_types, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MethodHandle cuOptCreateProblem$handle() { + return cuOptCreateProblem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficent_values, const char *constraint_sense, const cuopt_float_t *rhs, const cuopt_float_t *lower_bounds, const cuopt_float_t *upper_bounds, const char *variable_types, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MemorySegment cuOptCreateProblem$address() { + return cuOptCreateProblem.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptCreateProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficent_values, const char *constraint_sense, const cuopt_float_t *rhs, const cuopt_float_t *lower_bounds, const cuopt_float_t *upper_bounds, const char *variable_types, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static int cuOptCreateProblem(int num_constraints, int num_variables, int objective_sense, double objective_offset, MemorySegment objective_coefficients, MemorySegment constraint_matrix_row_offsets, MemorySegment constraint_matrix_column_indices, MemorySegment constraint_matrix_coefficent_values, MemorySegment constraint_sense, MemorySegment rhs, MemorySegment lower_bounds, MemorySegment upper_bounds, MemorySegment variable_types, MemorySegment problem_ptr) { + var mh$ = cuOptCreateProblem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptCreateProblem", num_constraints, num_variables, objective_sense, objective_offset, objective_coefficients, constraint_matrix_row_offsets, constraint_matrix_column_indices, constraint_matrix_coefficent_values, constraint_sense, rhs, lower_bounds, upper_bounds, variable_types, problem_ptr); + } + return (int)mh$.invokeExact(num_constraints, num_variables, objective_sense, objective_offset, objective_coefficients, constraint_matrix_row_offsets, constraint_matrix_column_indices, constraint_matrix_coefficent_values, constraint_sense, rhs, lower_bounds, upper_bounds, variable_types, problem_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptCreateRangedProblem { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptCreateRangedProblem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateRangedProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficients, const cuopt_float_t *constraint_lower_bounds, const cuopt_float_t *constraint_upper_bounds, const cuopt_float_t *variable_lower_bounds, const cuopt_float_t *variable_upper_bounds, const char *variable_types, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static FunctionDescriptor cuOptCreateRangedProblem$descriptor() { + return cuOptCreateRangedProblem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateRangedProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficients, const cuopt_float_t *constraint_lower_bounds, const cuopt_float_t *constraint_upper_bounds, const cuopt_float_t *variable_lower_bounds, const cuopt_float_t *variable_upper_bounds, const char *variable_types, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MethodHandle cuOptCreateRangedProblem$handle() { + return cuOptCreateRangedProblem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateRangedProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficients, const cuopt_float_t *constraint_lower_bounds, const cuopt_float_t *constraint_upper_bounds, const cuopt_float_t *variable_lower_bounds, const cuopt_float_t *variable_upper_bounds, const char *variable_types, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MemorySegment cuOptCreateRangedProblem$address() { + return cuOptCreateRangedProblem.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptCreateRangedProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficients, const cuopt_float_t *constraint_lower_bounds, const cuopt_float_t *constraint_upper_bounds, const cuopt_float_t *variable_lower_bounds, const cuopt_float_t *variable_upper_bounds, const char *variable_types, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static int cuOptCreateRangedProblem(int num_constraints, int num_variables, int objective_sense, double objective_offset, MemorySegment objective_coefficients, MemorySegment constraint_matrix_row_offsets, MemorySegment constraint_matrix_column_indices, MemorySegment constraint_matrix_coefficients, MemorySegment constraint_lower_bounds, MemorySegment constraint_upper_bounds, MemorySegment variable_lower_bounds, MemorySegment variable_upper_bounds, MemorySegment variable_types, MemorySegment problem_ptr) { + var mh$ = cuOptCreateRangedProblem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptCreateRangedProblem", num_constraints, num_variables, objective_sense, objective_offset, objective_coefficients, constraint_matrix_row_offsets, constraint_matrix_column_indices, constraint_matrix_coefficients, constraint_lower_bounds, constraint_upper_bounds, variable_lower_bounds, variable_upper_bounds, variable_types, problem_ptr); + } + return (int)mh$.invokeExact(num_constraints, num_variables, objective_sense, objective_offset, objective_coefficients, constraint_matrix_row_offsets, constraint_matrix_column_indices, constraint_matrix_coefficients, constraint_lower_bounds, constraint_upper_bounds, variable_lower_bounds, variable_upper_bounds, variable_types, problem_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptCreateQuadraticProblem { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptCreateQuadraticProblem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateQuadraticProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *quadratic_objective_matrix_row_offsets, const cuopt_int_t *quadratic_objective_matrix_column_indices, const cuopt_float_t *quadratic_objective_matrix_coefficent_values, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficent_values, const char *constraint_sense, const cuopt_float_t *rhs, const cuopt_float_t *lower_bounds, const cuopt_float_t *upper_bounds, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static FunctionDescriptor cuOptCreateQuadraticProblem$descriptor() { + return cuOptCreateQuadraticProblem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateQuadraticProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *quadratic_objective_matrix_row_offsets, const cuopt_int_t *quadratic_objective_matrix_column_indices, const cuopt_float_t *quadratic_objective_matrix_coefficent_values, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficent_values, const char *constraint_sense, const cuopt_float_t *rhs, const cuopt_float_t *lower_bounds, const cuopt_float_t *upper_bounds, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MethodHandle cuOptCreateQuadraticProblem$handle() { + return cuOptCreateQuadraticProblem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateQuadraticProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *quadratic_objective_matrix_row_offsets, const cuopt_int_t *quadratic_objective_matrix_column_indices, const cuopt_float_t *quadratic_objective_matrix_coefficent_values, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficent_values, const char *constraint_sense, const cuopt_float_t *rhs, const cuopt_float_t *lower_bounds, const cuopt_float_t *upper_bounds, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MemorySegment cuOptCreateQuadraticProblem$address() { + return cuOptCreateQuadraticProblem.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptCreateQuadraticProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *quadratic_objective_matrix_row_offsets, const cuopt_int_t *quadratic_objective_matrix_column_indices, const cuopt_float_t *quadratic_objective_matrix_coefficent_values, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficent_values, const char *constraint_sense, const cuopt_float_t *rhs, const cuopt_float_t *lower_bounds, const cuopt_float_t *upper_bounds, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static int cuOptCreateQuadraticProblem(int num_constraints, int num_variables, int objective_sense, double objective_offset, MemorySegment objective_coefficients, MemorySegment quadratic_objective_matrix_row_offsets, MemorySegment quadratic_objective_matrix_column_indices, MemorySegment quadratic_objective_matrix_coefficent_values, MemorySegment constraint_matrix_row_offsets, MemorySegment constraint_matrix_column_indices, MemorySegment constraint_matrix_coefficent_values, MemorySegment constraint_sense, MemorySegment rhs, MemorySegment lower_bounds, MemorySegment upper_bounds, MemorySegment problem_ptr) { + var mh$ = cuOptCreateQuadraticProblem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptCreateQuadraticProblem", num_constraints, num_variables, objective_sense, objective_offset, objective_coefficients, quadratic_objective_matrix_row_offsets, quadratic_objective_matrix_column_indices, quadratic_objective_matrix_coefficent_values, constraint_matrix_row_offsets, constraint_matrix_column_indices, constraint_matrix_coefficent_values, constraint_sense, rhs, lower_bounds, upper_bounds, problem_ptr); + } + return (int)mh$.invokeExact(num_constraints, num_variables, objective_sense, objective_offset, objective_coefficients, quadratic_objective_matrix_row_offsets, quadratic_objective_matrix_column_indices, quadratic_objective_matrix_coefficent_values, constraint_matrix_row_offsets, constraint_matrix_column_indices, constraint_matrix_coefficent_values, constraint_sense, rhs, lower_bounds, upper_bounds, problem_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptCreateQuadraticRangedProblem { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_INT, + cuopt_c_h.C_DOUBLE, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptCreateQuadraticRangedProblem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateQuadraticRangedProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *quadratic_objective_matrix_row_offsets, const cuopt_int_t *quadratic_objective_matrix_column_indices, const cuopt_float_t *quadratic_objective_matrix_coefficent_values, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficients, const cuopt_float_t *constraint_lower_bounds, const cuopt_float_t *constraint_upper_bounds, const cuopt_float_t *variable_lower_bounds, const cuopt_float_t *variable_upper_bounds, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static FunctionDescriptor cuOptCreateQuadraticRangedProblem$descriptor() { + return cuOptCreateQuadraticRangedProblem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateQuadraticRangedProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *quadratic_objective_matrix_row_offsets, const cuopt_int_t *quadratic_objective_matrix_column_indices, const cuopt_float_t *quadratic_objective_matrix_coefficent_values, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficients, const cuopt_float_t *constraint_lower_bounds, const cuopt_float_t *constraint_upper_bounds, const cuopt_float_t *variable_lower_bounds, const cuopt_float_t *variable_upper_bounds, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MethodHandle cuOptCreateQuadraticRangedProblem$handle() { + return cuOptCreateQuadraticRangedProblem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateQuadraticRangedProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *quadratic_objective_matrix_row_offsets, const cuopt_int_t *quadratic_objective_matrix_column_indices, const cuopt_float_t *quadratic_objective_matrix_coefficent_values, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficients, const cuopt_float_t *constraint_lower_bounds, const cuopt_float_t *constraint_upper_bounds, const cuopt_float_t *variable_lower_bounds, const cuopt_float_t *variable_upper_bounds, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MemorySegment cuOptCreateQuadraticRangedProblem$address() { + return cuOptCreateQuadraticRangedProblem.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptCreateQuadraticRangedProblem(cuopt_int_t num_constraints, cuopt_int_t num_variables, cuopt_int_t objective_sense, cuopt_float_t objective_offset, const cuopt_float_t *objective_coefficients, const cuopt_int_t *quadratic_objective_matrix_row_offsets, const cuopt_int_t *quadratic_objective_matrix_column_indices, const cuopt_float_t *quadratic_objective_matrix_coefficent_values, const cuopt_int_t *constraint_matrix_row_offsets, const cuopt_int_t *constraint_matrix_column_indices, const cuopt_float_t *constraint_matrix_coefficients, const cuopt_float_t *constraint_lower_bounds, const cuopt_float_t *constraint_upper_bounds, const cuopt_float_t *variable_lower_bounds, const cuopt_float_t *variable_upper_bounds, cuOptOptimizationProblem *problem_ptr) + * } + */ + public static int cuOptCreateQuadraticRangedProblem(int num_constraints, int num_variables, int objective_sense, double objective_offset, MemorySegment objective_coefficients, MemorySegment quadratic_objective_matrix_row_offsets, MemorySegment quadratic_objective_matrix_column_indices, MemorySegment quadratic_objective_matrix_coefficent_values, MemorySegment constraint_matrix_row_offsets, MemorySegment constraint_matrix_column_indices, MemorySegment constraint_matrix_coefficients, MemorySegment constraint_lower_bounds, MemorySegment constraint_upper_bounds, MemorySegment variable_lower_bounds, MemorySegment variable_upper_bounds, MemorySegment problem_ptr) { + var mh$ = cuOptCreateQuadraticRangedProblem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptCreateQuadraticRangedProblem", num_constraints, num_variables, objective_sense, objective_offset, objective_coefficients, quadratic_objective_matrix_row_offsets, quadratic_objective_matrix_column_indices, quadratic_objective_matrix_coefficent_values, constraint_matrix_row_offsets, constraint_matrix_column_indices, constraint_matrix_coefficients, constraint_lower_bounds, constraint_upper_bounds, variable_lower_bounds, variable_upper_bounds, problem_ptr); + } + return (int)mh$.invokeExact(num_constraints, num_variables, objective_sense, objective_offset, objective_coefficients, quadratic_objective_matrix_row_offsets, quadratic_objective_matrix_column_indices, quadratic_objective_matrix_coefficent_values, constraint_matrix_row_offsets, constraint_matrix_column_indices, constraint_matrix_coefficients, constraint_lower_bounds, constraint_upper_bounds, variable_lower_bounds, variable_upper_bounds, problem_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptDestroyProblem { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptDestroyProblem"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void cuOptDestroyProblem(cuOptOptimizationProblem *problem_ptr) + * } + */ + public static FunctionDescriptor cuOptDestroyProblem$descriptor() { + return cuOptDestroyProblem.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void cuOptDestroyProblem(cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MethodHandle cuOptDestroyProblem$handle() { + return cuOptDestroyProblem.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void cuOptDestroyProblem(cuOptOptimizationProblem *problem_ptr) + * } + */ + public static MemorySegment cuOptDestroyProblem$address() { + return cuOptDestroyProblem.ADDR; + } + + /** + * {@snippet lang=c : + * void cuOptDestroyProblem(cuOptOptimizationProblem *problem_ptr) + * } + */ + public static void cuOptDestroyProblem(MemorySegment problem_ptr) { + var mh$ = cuOptDestroyProblem.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptDestroyProblem", problem_ptr); + } + mh$.invokeExact(problem_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetNumConstraints { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetNumConstraints"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumConstraints(cuOptOptimizationProblem problem, cuopt_int_t *num_constraints_ptr) + * } + */ + public static FunctionDescriptor cuOptGetNumConstraints$descriptor() { + return cuOptGetNumConstraints.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumConstraints(cuOptOptimizationProblem problem, cuopt_int_t *num_constraints_ptr) + * } + */ + public static MethodHandle cuOptGetNumConstraints$handle() { + return cuOptGetNumConstraints.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumConstraints(cuOptOptimizationProblem problem, cuopt_int_t *num_constraints_ptr) + * } + */ + public static MemorySegment cuOptGetNumConstraints$address() { + return cuOptGetNumConstraints.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumConstraints(cuOptOptimizationProblem problem, cuopt_int_t *num_constraints_ptr) + * } + */ + public static int cuOptGetNumConstraints(MemorySegment problem, MemorySegment num_constraints_ptr) { + var mh$ = cuOptGetNumConstraints.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetNumConstraints", problem, num_constraints_ptr); + } + return (int)mh$.invokeExact(problem, num_constraints_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetNumVariables { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetNumVariables"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumVariables(cuOptOptimizationProblem problem, cuopt_int_t *num_variables_ptr) + * } + */ + public static FunctionDescriptor cuOptGetNumVariables$descriptor() { + return cuOptGetNumVariables.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumVariables(cuOptOptimizationProblem problem, cuopt_int_t *num_variables_ptr) + * } + */ + public static MethodHandle cuOptGetNumVariables$handle() { + return cuOptGetNumVariables.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumVariables(cuOptOptimizationProblem problem, cuopt_int_t *num_variables_ptr) + * } + */ + public static MemorySegment cuOptGetNumVariables$address() { + return cuOptGetNumVariables.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumVariables(cuOptOptimizationProblem problem, cuopt_int_t *num_variables_ptr) + * } + */ + public static int cuOptGetNumVariables(MemorySegment problem, MemorySegment num_variables_ptr) { + var mh$ = cuOptGetNumVariables.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetNumVariables", problem, num_variables_ptr); + } + return (int)mh$.invokeExact(problem, num_variables_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetObjectiveSense { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetObjectiveSense"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveSense(cuOptOptimizationProblem problem, cuopt_int_t *objective_sense_ptr) + * } + */ + public static FunctionDescriptor cuOptGetObjectiveSense$descriptor() { + return cuOptGetObjectiveSense.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveSense(cuOptOptimizationProblem problem, cuopt_int_t *objective_sense_ptr) + * } + */ + public static MethodHandle cuOptGetObjectiveSense$handle() { + return cuOptGetObjectiveSense.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveSense(cuOptOptimizationProblem problem, cuopt_int_t *objective_sense_ptr) + * } + */ + public static MemorySegment cuOptGetObjectiveSense$address() { + return cuOptGetObjectiveSense.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveSense(cuOptOptimizationProblem problem, cuopt_int_t *objective_sense_ptr) + * } + */ + public static int cuOptGetObjectiveSense(MemorySegment problem, MemorySegment objective_sense_ptr) { + var mh$ = cuOptGetObjectiveSense.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetObjectiveSense", problem, objective_sense_ptr); + } + return (int)mh$.invokeExact(problem, objective_sense_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetObjectiveOffset { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetObjectiveOffset"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveOffset(cuOptOptimizationProblem problem, cuopt_float_t *objective_offset_ptr) + * } + */ + public static FunctionDescriptor cuOptGetObjectiveOffset$descriptor() { + return cuOptGetObjectiveOffset.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveOffset(cuOptOptimizationProblem problem, cuopt_float_t *objective_offset_ptr) + * } + */ + public static MethodHandle cuOptGetObjectiveOffset$handle() { + return cuOptGetObjectiveOffset.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveOffset(cuOptOptimizationProblem problem, cuopt_float_t *objective_offset_ptr) + * } + */ + public static MemorySegment cuOptGetObjectiveOffset$address() { + return cuOptGetObjectiveOffset.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveOffset(cuOptOptimizationProblem problem, cuopt_float_t *objective_offset_ptr) + * } + */ + public static int cuOptGetObjectiveOffset(MemorySegment problem, MemorySegment objective_offset_ptr) { + var mh$ = cuOptGetObjectiveOffset.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetObjectiveOffset", problem, objective_offset_ptr); + } + return (int)mh$.invokeExact(problem, objective_offset_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetObjectiveCoefficients { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetObjectiveCoefficients"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveCoefficients(cuOptOptimizationProblem problem, cuopt_float_t *objective_coefficients_ptr) + * } + */ + public static FunctionDescriptor cuOptGetObjectiveCoefficients$descriptor() { + return cuOptGetObjectiveCoefficients.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveCoefficients(cuOptOptimizationProblem problem, cuopt_float_t *objective_coefficients_ptr) + * } + */ + public static MethodHandle cuOptGetObjectiveCoefficients$handle() { + return cuOptGetObjectiveCoefficients.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveCoefficients(cuOptOptimizationProblem problem, cuopt_float_t *objective_coefficients_ptr) + * } + */ + public static MemorySegment cuOptGetObjectiveCoefficients$address() { + return cuOptGetObjectiveCoefficients.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveCoefficients(cuOptOptimizationProblem problem, cuopt_float_t *objective_coefficients_ptr) + * } + */ + public static int cuOptGetObjectiveCoefficients(MemorySegment problem, MemorySegment objective_coefficients_ptr) { + var mh$ = cuOptGetObjectiveCoefficients.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetObjectiveCoefficients", problem, objective_coefficients_ptr); + } + return (int)mh$.invokeExact(problem, objective_coefficients_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetNumNonZeros { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetNumNonZeros"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumNonZeros(cuOptOptimizationProblem problem, cuopt_int_t *num_non_zeros_ptr) + * } + */ + public static FunctionDescriptor cuOptGetNumNonZeros$descriptor() { + return cuOptGetNumNonZeros.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumNonZeros(cuOptOptimizationProblem problem, cuopt_int_t *num_non_zeros_ptr) + * } + */ + public static MethodHandle cuOptGetNumNonZeros$handle() { + return cuOptGetNumNonZeros.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumNonZeros(cuOptOptimizationProblem problem, cuopt_int_t *num_non_zeros_ptr) + * } + */ + public static MemorySegment cuOptGetNumNonZeros$address() { + return cuOptGetNumNonZeros.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetNumNonZeros(cuOptOptimizationProblem problem, cuopt_int_t *num_non_zeros_ptr) + * } + */ + public static int cuOptGetNumNonZeros(MemorySegment problem, MemorySegment num_non_zeros_ptr) { + var mh$ = cuOptGetNumNonZeros.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetNumNonZeros", problem, num_non_zeros_ptr); + } + return (int)mh$.invokeExact(problem, num_non_zeros_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetConstraintMatrix { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetConstraintMatrix"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintMatrix(cuOptOptimizationProblem problem, cuopt_int_t *constraint_matrix_row_offsets_ptr, cuopt_int_t *constraint_matrix_column_indices_ptr, cuopt_float_t *constraint_matrix_coefficients_ptr) + * } + */ + public static FunctionDescriptor cuOptGetConstraintMatrix$descriptor() { + return cuOptGetConstraintMatrix.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintMatrix(cuOptOptimizationProblem problem, cuopt_int_t *constraint_matrix_row_offsets_ptr, cuopt_int_t *constraint_matrix_column_indices_ptr, cuopt_float_t *constraint_matrix_coefficients_ptr) + * } + */ + public static MethodHandle cuOptGetConstraintMatrix$handle() { + return cuOptGetConstraintMatrix.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintMatrix(cuOptOptimizationProblem problem, cuopt_int_t *constraint_matrix_row_offsets_ptr, cuopt_int_t *constraint_matrix_column_indices_ptr, cuopt_float_t *constraint_matrix_coefficients_ptr) + * } + */ + public static MemorySegment cuOptGetConstraintMatrix$address() { + return cuOptGetConstraintMatrix.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintMatrix(cuOptOptimizationProblem problem, cuopt_int_t *constraint_matrix_row_offsets_ptr, cuopt_int_t *constraint_matrix_column_indices_ptr, cuopt_float_t *constraint_matrix_coefficients_ptr) + * } + */ + public static int cuOptGetConstraintMatrix(MemorySegment problem, MemorySegment constraint_matrix_row_offsets_ptr, MemorySegment constraint_matrix_column_indices_ptr, MemorySegment constraint_matrix_coefficients_ptr) { + var mh$ = cuOptGetConstraintMatrix.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetConstraintMatrix", problem, constraint_matrix_row_offsets_ptr, constraint_matrix_column_indices_ptr, constraint_matrix_coefficients_ptr); + } + return (int)mh$.invokeExact(problem, constraint_matrix_row_offsets_ptr, constraint_matrix_column_indices_ptr, constraint_matrix_coefficients_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetConstraintSense { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetConstraintSense"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintSense(cuOptOptimizationProblem problem, char *constraint_sense_ptr) + * } + */ + public static FunctionDescriptor cuOptGetConstraintSense$descriptor() { + return cuOptGetConstraintSense.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintSense(cuOptOptimizationProblem problem, char *constraint_sense_ptr) + * } + */ + public static MethodHandle cuOptGetConstraintSense$handle() { + return cuOptGetConstraintSense.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintSense(cuOptOptimizationProblem problem, char *constraint_sense_ptr) + * } + */ + public static MemorySegment cuOptGetConstraintSense$address() { + return cuOptGetConstraintSense.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintSense(cuOptOptimizationProblem problem, char *constraint_sense_ptr) + * } + */ + public static int cuOptGetConstraintSense(MemorySegment problem, MemorySegment constraint_sense_ptr) { + var mh$ = cuOptGetConstraintSense.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetConstraintSense", problem, constraint_sense_ptr); + } + return (int)mh$.invokeExact(problem, constraint_sense_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetConstraintRightHandSide { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetConstraintRightHandSide"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintRightHandSide(cuOptOptimizationProblem problem, cuopt_float_t *rhs_ptr) + * } + */ + public static FunctionDescriptor cuOptGetConstraintRightHandSide$descriptor() { + return cuOptGetConstraintRightHandSide.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintRightHandSide(cuOptOptimizationProblem problem, cuopt_float_t *rhs_ptr) + * } + */ + public static MethodHandle cuOptGetConstraintRightHandSide$handle() { + return cuOptGetConstraintRightHandSide.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintRightHandSide(cuOptOptimizationProblem problem, cuopt_float_t *rhs_ptr) + * } + */ + public static MemorySegment cuOptGetConstraintRightHandSide$address() { + return cuOptGetConstraintRightHandSide.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintRightHandSide(cuOptOptimizationProblem problem, cuopt_float_t *rhs_ptr) + * } + */ + public static int cuOptGetConstraintRightHandSide(MemorySegment problem, MemorySegment rhs_ptr) { + var mh$ = cuOptGetConstraintRightHandSide.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetConstraintRightHandSide", problem, rhs_ptr); + } + return (int)mh$.invokeExact(problem, rhs_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetConstraintLowerBounds { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetConstraintLowerBounds"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintLowerBounds(cuOptOptimizationProblem problem, cuopt_float_t *lower_bounds_ptr) + * } + */ + public static FunctionDescriptor cuOptGetConstraintLowerBounds$descriptor() { + return cuOptGetConstraintLowerBounds.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintLowerBounds(cuOptOptimizationProblem problem, cuopt_float_t *lower_bounds_ptr) + * } + */ + public static MethodHandle cuOptGetConstraintLowerBounds$handle() { + return cuOptGetConstraintLowerBounds.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintLowerBounds(cuOptOptimizationProblem problem, cuopt_float_t *lower_bounds_ptr) + * } + */ + public static MemorySegment cuOptGetConstraintLowerBounds$address() { + return cuOptGetConstraintLowerBounds.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintLowerBounds(cuOptOptimizationProblem problem, cuopt_float_t *lower_bounds_ptr) + * } + */ + public static int cuOptGetConstraintLowerBounds(MemorySegment problem, MemorySegment lower_bounds_ptr) { + var mh$ = cuOptGetConstraintLowerBounds.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetConstraintLowerBounds", problem, lower_bounds_ptr); + } + return (int)mh$.invokeExact(problem, lower_bounds_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetConstraintUpperBounds { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetConstraintUpperBounds"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintUpperBounds(cuOptOptimizationProblem problem, cuopt_float_t *upper_bounds_ptr) + * } + */ + public static FunctionDescriptor cuOptGetConstraintUpperBounds$descriptor() { + return cuOptGetConstraintUpperBounds.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintUpperBounds(cuOptOptimizationProblem problem, cuopt_float_t *upper_bounds_ptr) + * } + */ + public static MethodHandle cuOptGetConstraintUpperBounds$handle() { + return cuOptGetConstraintUpperBounds.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintUpperBounds(cuOptOptimizationProblem problem, cuopt_float_t *upper_bounds_ptr) + * } + */ + public static MemorySegment cuOptGetConstraintUpperBounds$address() { + return cuOptGetConstraintUpperBounds.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetConstraintUpperBounds(cuOptOptimizationProblem problem, cuopt_float_t *upper_bounds_ptr) + * } + */ + public static int cuOptGetConstraintUpperBounds(MemorySegment problem, MemorySegment upper_bounds_ptr) { + var mh$ = cuOptGetConstraintUpperBounds.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetConstraintUpperBounds", problem, upper_bounds_ptr); + } + return (int)mh$.invokeExact(problem, upper_bounds_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetVariableLowerBounds { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetVariableLowerBounds"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableLowerBounds(cuOptOptimizationProblem problem, cuopt_float_t *lower_bounds_ptr) + * } + */ + public static FunctionDescriptor cuOptGetVariableLowerBounds$descriptor() { + return cuOptGetVariableLowerBounds.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableLowerBounds(cuOptOptimizationProblem problem, cuopt_float_t *lower_bounds_ptr) + * } + */ + public static MethodHandle cuOptGetVariableLowerBounds$handle() { + return cuOptGetVariableLowerBounds.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableLowerBounds(cuOptOptimizationProblem problem, cuopt_float_t *lower_bounds_ptr) + * } + */ + public static MemorySegment cuOptGetVariableLowerBounds$address() { + return cuOptGetVariableLowerBounds.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableLowerBounds(cuOptOptimizationProblem problem, cuopt_float_t *lower_bounds_ptr) + * } + */ + public static int cuOptGetVariableLowerBounds(MemorySegment problem, MemorySegment lower_bounds_ptr) { + var mh$ = cuOptGetVariableLowerBounds.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetVariableLowerBounds", problem, lower_bounds_ptr); + } + return (int)mh$.invokeExact(problem, lower_bounds_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetVariableUpperBounds { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetVariableUpperBounds"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableUpperBounds(cuOptOptimizationProblem problem, cuopt_float_t *upper_bounds_ptr) + * } + */ + public static FunctionDescriptor cuOptGetVariableUpperBounds$descriptor() { + return cuOptGetVariableUpperBounds.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableUpperBounds(cuOptOptimizationProblem problem, cuopt_float_t *upper_bounds_ptr) + * } + */ + public static MethodHandle cuOptGetVariableUpperBounds$handle() { + return cuOptGetVariableUpperBounds.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableUpperBounds(cuOptOptimizationProblem problem, cuopt_float_t *upper_bounds_ptr) + * } + */ + public static MemorySegment cuOptGetVariableUpperBounds$address() { + return cuOptGetVariableUpperBounds.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableUpperBounds(cuOptOptimizationProblem problem, cuopt_float_t *upper_bounds_ptr) + * } + */ + public static int cuOptGetVariableUpperBounds(MemorySegment problem, MemorySegment upper_bounds_ptr) { + var mh$ = cuOptGetVariableUpperBounds.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetVariableUpperBounds", problem, upper_bounds_ptr); + } + return (int)mh$.invokeExact(problem, upper_bounds_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetVariableTypes { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetVariableTypes"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableTypes(cuOptOptimizationProblem problem, char *variable_types_ptr) + * } + */ + public static FunctionDescriptor cuOptGetVariableTypes$descriptor() { + return cuOptGetVariableTypes.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableTypes(cuOptOptimizationProblem problem, char *variable_types_ptr) + * } + */ + public static MethodHandle cuOptGetVariableTypes$handle() { + return cuOptGetVariableTypes.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableTypes(cuOptOptimizationProblem problem, char *variable_types_ptr) + * } + */ + public static MemorySegment cuOptGetVariableTypes$address() { + return cuOptGetVariableTypes.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetVariableTypes(cuOptOptimizationProblem problem, char *variable_types_ptr) + * } + */ + public static int cuOptGetVariableTypes(MemorySegment problem, MemorySegment variable_types_ptr) { + var mh$ = cuOptGetVariableTypes.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetVariableTypes", problem, variable_types_ptr); + } + return (int)mh$.invokeExact(problem, variable_types_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptCreateSolverSettings { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptCreateSolverSettings"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateSolverSettings(cuOptSolverSettings *settings_ptr) + * } + */ + public static FunctionDescriptor cuOptCreateSolverSettings$descriptor() { + return cuOptCreateSolverSettings.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateSolverSettings(cuOptSolverSettings *settings_ptr) + * } + */ + public static MethodHandle cuOptCreateSolverSettings$handle() { + return cuOptCreateSolverSettings.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptCreateSolverSettings(cuOptSolverSettings *settings_ptr) + * } + */ + public static MemorySegment cuOptCreateSolverSettings$address() { + return cuOptCreateSolverSettings.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptCreateSolverSettings(cuOptSolverSettings *settings_ptr) + * } + */ + public static int cuOptCreateSolverSettings(MemorySegment settings_ptr) { + var mh$ = cuOptCreateSolverSettings.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptCreateSolverSettings", settings_ptr); + } + return (int)mh$.invokeExact(settings_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptDestroySolverSettings { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptDestroySolverSettings"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void cuOptDestroySolverSettings(cuOptSolverSettings *settings_ptr) + * } + */ + public static FunctionDescriptor cuOptDestroySolverSettings$descriptor() { + return cuOptDestroySolverSettings.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void cuOptDestroySolverSettings(cuOptSolverSettings *settings_ptr) + * } + */ + public static MethodHandle cuOptDestroySolverSettings$handle() { + return cuOptDestroySolverSettings.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void cuOptDestroySolverSettings(cuOptSolverSettings *settings_ptr) + * } + */ + public static MemorySegment cuOptDestroySolverSettings$address() { + return cuOptDestroySolverSettings.ADDR; + } + + /** + * {@snippet lang=c : + * void cuOptDestroySolverSettings(cuOptSolverSettings *settings_ptr) + * } + */ + public static void cuOptDestroySolverSettings(MemorySegment settings_ptr) { + var mh$ = cuOptDestroySolverSettings.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptDestroySolverSettings", settings_ptr); + } + mh$.invokeExact(settings_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptSetParameter { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptSetParameter"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetParameter(cuOptSolverSettings settings, const char *parameter_name, const char *parameter_value) + * } + */ + public static FunctionDescriptor cuOptSetParameter$descriptor() { + return cuOptSetParameter.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetParameter(cuOptSolverSettings settings, const char *parameter_name, const char *parameter_value) + * } + */ + public static MethodHandle cuOptSetParameter$handle() { + return cuOptSetParameter.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetParameter(cuOptSolverSettings settings, const char *parameter_name, const char *parameter_value) + * } + */ + public static MemorySegment cuOptSetParameter$address() { + return cuOptSetParameter.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptSetParameter(cuOptSolverSettings settings, const char *parameter_name, const char *parameter_value) + * } + */ + public static int cuOptSetParameter(MemorySegment settings, MemorySegment parameter_name, MemorySegment parameter_value) { + var mh$ = cuOptSetParameter.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptSetParameter", settings, parameter_name, parameter_value); + } + return (int)mh$.invokeExact(settings, parameter_name, parameter_value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetParameter { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetParameter"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t parameter_value_size, char *parameter_value) + * } + */ + public static FunctionDescriptor cuOptGetParameter$descriptor() { + return cuOptGetParameter.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t parameter_value_size, char *parameter_value) + * } + */ + public static MethodHandle cuOptGetParameter$handle() { + return cuOptGetParameter.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t parameter_value_size, char *parameter_value) + * } + */ + public static MemorySegment cuOptGetParameter$address() { + return cuOptGetParameter.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t parameter_value_size, char *parameter_value) + * } + */ + public static int cuOptGetParameter(MemorySegment settings, MemorySegment parameter_name, int parameter_value_size, MemorySegment parameter_value) { + var mh$ = cuOptGetParameter.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetParameter", settings, parameter_name, parameter_value_size, parameter_value); + } + return (int)mh$.invokeExact(settings, parameter_name, parameter_value_size, parameter_value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptSetIntegerParameter { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptSetIntegerParameter"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetIntegerParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t parameter_value) + * } + */ + public static FunctionDescriptor cuOptSetIntegerParameter$descriptor() { + return cuOptSetIntegerParameter.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetIntegerParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t parameter_value) + * } + */ + public static MethodHandle cuOptSetIntegerParameter$handle() { + return cuOptSetIntegerParameter.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetIntegerParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t parameter_value) + * } + */ + public static MemorySegment cuOptSetIntegerParameter$address() { + return cuOptSetIntegerParameter.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptSetIntegerParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t parameter_value) + * } + */ + public static int cuOptSetIntegerParameter(MemorySegment settings, MemorySegment parameter_name, int parameter_value) { + var mh$ = cuOptSetIntegerParameter.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptSetIntegerParameter", settings, parameter_name, parameter_value); + } + return (int)mh$.invokeExact(settings, parameter_name, parameter_value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetIntegerParameter { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetIntegerParameter"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetIntegerParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t *parameter_value) + * } + */ + public static FunctionDescriptor cuOptGetIntegerParameter$descriptor() { + return cuOptGetIntegerParameter.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetIntegerParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t *parameter_value) + * } + */ + public static MethodHandle cuOptGetIntegerParameter$handle() { + return cuOptGetIntegerParameter.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetIntegerParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t *parameter_value) + * } + */ + public static MemorySegment cuOptGetIntegerParameter$address() { + return cuOptGetIntegerParameter.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetIntegerParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_int_t *parameter_value) + * } + */ + public static int cuOptGetIntegerParameter(MemorySegment settings, MemorySegment parameter_name, MemorySegment parameter_value) { + var mh$ = cuOptGetIntegerParameter.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetIntegerParameter", settings, parameter_name, parameter_value); + } + return (int)mh$.invokeExact(settings, parameter_name, parameter_value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptSetFloatParameter { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_DOUBLE + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptSetFloatParameter"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetFloatParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_float_t parameter_value) + * } + */ + public static FunctionDescriptor cuOptSetFloatParameter$descriptor() { + return cuOptSetFloatParameter.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetFloatParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_float_t parameter_value) + * } + */ + public static MethodHandle cuOptSetFloatParameter$handle() { + return cuOptSetFloatParameter.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetFloatParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_float_t parameter_value) + * } + */ + public static MemorySegment cuOptSetFloatParameter$address() { + return cuOptSetFloatParameter.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptSetFloatParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_float_t parameter_value) + * } + */ + public static int cuOptSetFloatParameter(MemorySegment settings, MemorySegment parameter_name, double parameter_value) { + var mh$ = cuOptSetFloatParameter.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptSetFloatParameter", settings, parameter_name, parameter_value); + } + return (int)mh$.invokeExact(settings, parameter_name, parameter_value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetFloatParameter { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetFloatParameter"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetFloatParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_float_t *parameter_value) + * } + */ + public static FunctionDescriptor cuOptGetFloatParameter$descriptor() { + return cuOptGetFloatParameter.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetFloatParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_float_t *parameter_value) + * } + */ + public static MethodHandle cuOptGetFloatParameter$handle() { + return cuOptGetFloatParameter.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetFloatParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_float_t *parameter_value) + * } + */ + public static MemorySegment cuOptGetFloatParameter$address() { + return cuOptGetFloatParameter.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetFloatParameter(cuOptSolverSettings settings, const char *parameter_name, cuopt_float_t *parameter_value) + * } + */ + public static int cuOptGetFloatParameter(MemorySegment settings, MemorySegment parameter_name, MemorySegment parameter_value) { + var mh$ = cuOptGetFloatParameter.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetFloatParameter", settings, parameter_name, parameter_value); + } + return (int)mh$.invokeExact(settings, parameter_name, parameter_value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptSetMIPGetSolutionCallback { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptSetMIPGetSolutionCallback"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetMIPGetSolutionCallback(cuOptSolverSettings settings, cuOptMIPGetSolutionCallback callback, void *user_data) + * } + */ + public static FunctionDescriptor cuOptSetMIPGetSolutionCallback$descriptor() { + return cuOptSetMIPGetSolutionCallback.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetMIPGetSolutionCallback(cuOptSolverSettings settings, cuOptMIPGetSolutionCallback callback, void *user_data) + * } + */ + public static MethodHandle cuOptSetMIPGetSolutionCallback$handle() { + return cuOptSetMIPGetSolutionCallback.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetMIPGetSolutionCallback(cuOptSolverSettings settings, cuOptMIPGetSolutionCallback callback, void *user_data) + * } + */ + public static MemorySegment cuOptSetMIPGetSolutionCallback$address() { + return cuOptSetMIPGetSolutionCallback.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptSetMIPGetSolutionCallback(cuOptSolverSettings settings, cuOptMIPGetSolutionCallback callback, void *user_data) + * } + */ + public static int cuOptSetMIPGetSolutionCallback(MemorySegment settings, MemorySegment callback, MemorySegment user_data) { + var mh$ = cuOptSetMIPGetSolutionCallback.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptSetMIPGetSolutionCallback", settings, callback, user_data); + } + return (int)mh$.invokeExact(settings, callback, user_data); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptSetMIPSetSolutionCallback { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptSetMIPSetSolutionCallback"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetMIPSetSolutionCallback(cuOptSolverSettings settings, cuOptMIPSetSolutionCallback callback, void *user_data) + * } + */ + public static FunctionDescriptor cuOptSetMIPSetSolutionCallback$descriptor() { + return cuOptSetMIPSetSolutionCallback.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetMIPSetSolutionCallback(cuOptSolverSettings settings, cuOptMIPSetSolutionCallback callback, void *user_data) + * } + */ + public static MethodHandle cuOptSetMIPSetSolutionCallback$handle() { + return cuOptSetMIPSetSolutionCallback.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetMIPSetSolutionCallback(cuOptSolverSettings settings, cuOptMIPSetSolutionCallback callback, void *user_data) + * } + */ + public static MemorySegment cuOptSetMIPSetSolutionCallback$address() { + return cuOptSetMIPSetSolutionCallback.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptSetMIPSetSolutionCallback(cuOptSolverSettings settings, cuOptMIPSetSolutionCallback callback, void *user_data) + * } + */ + public static int cuOptSetMIPSetSolutionCallback(MemorySegment settings, MemorySegment callback, MemorySegment user_data) { + var mh$ = cuOptSetMIPSetSolutionCallback.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptSetMIPSetSolutionCallback", settings, callback, user_data); + } + return (int)mh$.invokeExact(settings, callback, user_data); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptSetInitialPrimalSolution { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptSetInitialPrimalSolution"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetInitialPrimalSolution(cuOptSolverSettings settings, const cuopt_float_t *primal_solution, cuopt_int_t num_variables) + * } + */ + public static FunctionDescriptor cuOptSetInitialPrimalSolution$descriptor() { + return cuOptSetInitialPrimalSolution.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetInitialPrimalSolution(cuOptSolverSettings settings, const cuopt_float_t *primal_solution, cuopt_int_t num_variables) + * } + */ + public static MethodHandle cuOptSetInitialPrimalSolution$handle() { + return cuOptSetInitialPrimalSolution.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetInitialPrimalSolution(cuOptSolverSettings settings, const cuopt_float_t *primal_solution, cuopt_int_t num_variables) + * } + */ + public static MemorySegment cuOptSetInitialPrimalSolution$address() { + return cuOptSetInitialPrimalSolution.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptSetInitialPrimalSolution(cuOptSolverSettings settings, const cuopt_float_t *primal_solution, cuopt_int_t num_variables) + * } + */ + public static int cuOptSetInitialPrimalSolution(MemorySegment settings, MemorySegment primal_solution, int num_variables) { + var mh$ = cuOptSetInitialPrimalSolution.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptSetInitialPrimalSolution", settings, primal_solution, num_variables); + } + return (int)mh$.invokeExact(settings, primal_solution, num_variables); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptSetInitialDualSolution { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptSetInitialDualSolution"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetInitialDualSolution(cuOptSolverSettings settings, const cuopt_float_t *dual_solution, cuopt_int_t num_constraints) + * } + */ + public static FunctionDescriptor cuOptSetInitialDualSolution$descriptor() { + return cuOptSetInitialDualSolution.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetInitialDualSolution(cuOptSolverSettings settings, const cuopt_float_t *dual_solution, cuopt_int_t num_constraints) + * } + */ + public static MethodHandle cuOptSetInitialDualSolution$handle() { + return cuOptSetInitialDualSolution.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptSetInitialDualSolution(cuOptSolverSettings settings, const cuopt_float_t *dual_solution, cuopt_int_t num_constraints) + * } + */ + public static MemorySegment cuOptSetInitialDualSolution$address() { + return cuOptSetInitialDualSolution.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptSetInitialDualSolution(cuOptSolverSettings settings, const cuopt_float_t *dual_solution, cuopt_int_t num_constraints) + * } + */ + public static int cuOptSetInitialDualSolution(MemorySegment settings, MemorySegment dual_solution, int num_constraints) { + var mh$ = cuOptSetInitialDualSolution.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptSetInitialDualSolution", settings, dual_solution, num_constraints); + } + return (int)mh$.invokeExact(settings, dual_solution, num_constraints); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptAddMIPStart { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptAddMIPStart"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptAddMIPStart(cuOptSolverSettings settings, const cuopt_float_t *solution, cuopt_int_t num_variables) + * } + */ + public static FunctionDescriptor cuOptAddMIPStart$descriptor() { + return cuOptAddMIPStart.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptAddMIPStart(cuOptSolverSettings settings, const cuopt_float_t *solution, cuopt_int_t num_variables) + * } + */ + public static MethodHandle cuOptAddMIPStart$handle() { + return cuOptAddMIPStart.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptAddMIPStart(cuOptSolverSettings settings, const cuopt_float_t *solution, cuopt_int_t num_variables) + * } + */ + public static MemorySegment cuOptAddMIPStart$address() { + return cuOptAddMIPStart.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptAddMIPStart(cuOptSolverSettings settings, const cuopt_float_t *solution, cuopt_int_t num_variables) + * } + */ + public static int cuOptAddMIPStart(MemorySegment settings, MemorySegment solution, int num_variables) { + var mh$ = cuOptAddMIPStart.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptAddMIPStart", settings, solution, num_variables); + } + return (int)mh$.invokeExact(settings, solution, num_variables); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptIsMIP { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptIsMIP"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptIsMIP(cuOptOptimizationProblem problem, cuopt_int_t *is_mip_ptr) + * } + */ + public static FunctionDescriptor cuOptIsMIP$descriptor() { + return cuOptIsMIP.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptIsMIP(cuOptOptimizationProblem problem, cuopt_int_t *is_mip_ptr) + * } + */ + public static MethodHandle cuOptIsMIP$handle() { + return cuOptIsMIP.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptIsMIP(cuOptOptimizationProblem problem, cuopt_int_t *is_mip_ptr) + * } + */ + public static MemorySegment cuOptIsMIP$address() { + return cuOptIsMIP.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptIsMIP(cuOptOptimizationProblem problem, cuopt_int_t *is_mip_ptr) + * } + */ + public static int cuOptIsMIP(MemorySegment problem, MemorySegment is_mip_ptr) { + var mh$ = cuOptIsMIP.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptIsMIP", problem, is_mip_ptr); + } + return (int)mh$.invokeExact(problem, is_mip_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptSolve { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptSolve"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptSolve(cuOptOptimizationProblem problem, cuOptSolverSettings settings, cuOptSolution *solution_ptr) + * } + */ + public static FunctionDescriptor cuOptSolve$descriptor() { + return cuOptSolve.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptSolve(cuOptOptimizationProblem problem, cuOptSolverSettings settings, cuOptSolution *solution_ptr) + * } + */ + public static MethodHandle cuOptSolve$handle() { + return cuOptSolve.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptSolve(cuOptOptimizationProblem problem, cuOptSolverSettings settings, cuOptSolution *solution_ptr) + * } + */ + public static MemorySegment cuOptSolve$address() { + return cuOptSolve.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptSolve(cuOptOptimizationProblem problem, cuOptSolverSettings settings, cuOptSolution *solution_ptr) + * } + */ + public static int cuOptSolve(MemorySegment problem, MemorySegment settings, MemorySegment solution_ptr) { + var mh$ = cuOptSolve.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptSolve", problem, settings, solution_ptr); + } + return (int)mh$.invokeExact(problem, settings, solution_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptDestroySolution { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptDestroySolution"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void cuOptDestroySolution(cuOptSolution *solution_ptr) + * } + */ + public static FunctionDescriptor cuOptDestroySolution$descriptor() { + return cuOptDestroySolution.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void cuOptDestroySolution(cuOptSolution *solution_ptr) + * } + */ + public static MethodHandle cuOptDestroySolution$handle() { + return cuOptDestroySolution.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void cuOptDestroySolution(cuOptSolution *solution_ptr) + * } + */ + public static MemorySegment cuOptDestroySolution$address() { + return cuOptDestroySolution.ADDR; + } + + /** + * {@snippet lang=c : + * void cuOptDestroySolution(cuOptSolution *solution_ptr) + * } + */ + public static void cuOptDestroySolution(MemorySegment solution_ptr) { + var mh$ = cuOptDestroySolution.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptDestroySolution", solution_ptr); + } + mh$.invokeExact(solution_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetTerminationStatus { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetTerminationStatus"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetTerminationStatus(cuOptSolution solution, cuopt_int_t *termination_status_ptr) + * } + */ + public static FunctionDescriptor cuOptGetTerminationStatus$descriptor() { + return cuOptGetTerminationStatus.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetTerminationStatus(cuOptSolution solution, cuopt_int_t *termination_status_ptr) + * } + */ + public static MethodHandle cuOptGetTerminationStatus$handle() { + return cuOptGetTerminationStatus.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetTerminationStatus(cuOptSolution solution, cuopt_int_t *termination_status_ptr) + * } + */ + public static MemorySegment cuOptGetTerminationStatus$address() { + return cuOptGetTerminationStatus.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetTerminationStatus(cuOptSolution solution, cuopt_int_t *termination_status_ptr) + * } + */ + public static int cuOptGetTerminationStatus(MemorySegment solution, MemorySegment termination_status_ptr) { + var mh$ = cuOptGetTerminationStatus.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetTerminationStatus", solution, termination_status_ptr); + } + return (int)mh$.invokeExact(solution, termination_status_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetErrorStatus { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetErrorStatus"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetErrorStatus(cuOptSolution solution, cuopt_int_t *error_status_ptr) + * } + */ + public static FunctionDescriptor cuOptGetErrorStatus$descriptor() { + return cuOptGetErrorStatus.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetErrorStatus(cuOptSolution solution, cuopt_int_t *error_status_ptr) + * } + */ + public static MethodHandle cuOptGetErrorStatus$handle() { + return cuOptGetErrorStatus.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetErrorStatus(cuOptSolution solution, cuopt_int_t *error_status_ptr) + * } + */ + public static MemorySegment cuOptGetErrorStatus$address() { + return cuOptGetErrorStatus.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetErrorStatus(cuOptSolution solution, cuopt_int_t *error_status_ptr) + * } + */ + public static int cuOptGetErrorStatus(MemorySegment solution, MemorySegment error_status_ptr) { + var mh$ = cuOptGetErrorStatus.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetErrorStatus", solution, error_status_ptr); + } + return (int)mh$.invokeExact(solution, error_status_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetErrorString { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_INT + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetErrorString"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetErrorString(cuOptSolution solution, char *error_string_ptr, cuopt_int_t error_string_size) + * } + */ + public static FunctionDescriptor cuOptGetErrorString$descriptor() { + return cuOptGetErrorString.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetErrorString(cuOptSolution solution, char *error_string_ptr, cuopt_int_t error_string_size) + * } + */ + public static MethodHandle cuOptGetErrorString$handle() { + return cuOptGetErrorString.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetErrorString(cuOptSolution solution, char *error_string_ptr, cuopt_int_t error_string_size) + * } + */ + public static MemorySegment cuOptGetErrorString$address() { + return cuOptGetErrorString.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetErrorString(cuOptSolution solution, char *error_string_ptr, cuopt_int_t error_string_size) + * } + */ + public static int cuOptGetErrorString(MemorySegment solution, MemorySegment error_string_ptr, int error_string_size) { + var mh$ = cuOptGetErrorString.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetErrorString", solution, error_string_ptr, error_string_size); + } + return (int)mh$.invokeExact(solution, error_string_ptr, error_string_size); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetPrimalSolution { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetPrimalSolution"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetPrimalSolution(cuOptSolution solution, cuopt_float_t *solution_values) + * } + */ + public static FunctionDescriptor cuOptGetPrimalSolution$descriptor() { + return cuOptGetPrimalSolution.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetPrimalSolution(cuOptSolution solution, cuopt_float_t *solution_values) + * } + */ + public static MethodHandle cuOptGetPrimalSolution$handle() { + return cuOptGetPrimalSolution.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetPrimalSolution(cuOptSolution solution, cuopt_float_t *solution_values) + * } + */ + public static MemorySegment cuOptGetPrimalSolution$address() { + return cuOptGetPrimalSolution.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetPrimalSolution(cuOptSolution solution, cuopt_float_t *solution_values) + * } + */ + public static int cuOptGetPrimalSolution(MemorySegment solution, MemorySegment solution_values) { + var mh$ = cuOptGetPrimalSolution.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetPrimalSolution", solution, solution_values); + } + return (int)mh$.invokeExact(solution, solution_values); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetObjectiveValue { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetObjectiveValue"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveValue(cuOptSolution solution, cuopt_float_t *objective_value_ptr) + * } + */ + public static FunctionDescriptor cuOptGetObjectiveValue$descriptor() { + return cuOptGetObjectiveValue.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveValue(cuOptSolution solution, cuopt_float_t *objective_value_ptr) + * } + */ + public static MethodHandle cuOptGetObjectiveValue$handle() { + return cuOptGetObjectiveValue.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveValue(cuOptSolution solution, cuopt_float_t *objective_value_ptr) + * } + */ + public static MemorySegment cuOptGetObjectiveValue$address() { + return cuOptGetObjectiveValue.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetObjectiveValue(cuOptSolution solution, cuopt_float_t *objective_value_ptr) + * } + */ + public static int cuOptGetObjectiveValue(MemorySegment solution, MemorySegment objective_value_ptr) { + var mh$ = cuOptGetObjectiveValue.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetObjectiveValue", solution, objective_value_ptr); + } + return (int)mh$.invokeExact(solution, objective_value_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetSolveTime { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetSolveTime"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetSolveTime(cuOptSolution solution, cuopt_float_t *solve_time_ptr) + * } + */ + public static FunctionDescriptor cuOptGetSolveTime$descriptor() { + return cuOptGetSolveTime.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetSolveTime(cuOptSolution solution, cuopt_float_t *solve_time_ptr) + * } + */ + public static MethodHandle cuOptGetSolveTime$handle() { + return cuOptGetSolveTime.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetSolveTime(cuOptSolution solution, cuopt_float_t *solve_time_ptr) + * } + */ + public static MemorySegment cuOptGetSolveTime$address() { + return cuOptGetSolveTime.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetSolveTime(cuOptSolution solution, cuopt_float_t *solve_time_ptr) + * } + */ + public static int cuOptGetSolveTime(MemorySegment solution, MemorySegment solve_time_ptr) { + var mh$ = cuOptGetSolveTime.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetSolveTime", solution, solve_time_ptr); + } + return (int)mh$.invokeExact(solution, solve_time_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetMIPGap { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetMIPGap"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetMIPGap(cuOptSolution solution, cuopt_float_t *mip_gap_ptr) + * } + */ + public static FunctionDescriptor cuOptGetMIPGap$descriptor() { + return cuOptGetMIPGap.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetMIPGap(cuOptSolution solution, cuopt_float_t *mip_gap_ptr) + * } + */ + public static MethodHandle cuOptGetMIPGap$handle() { + return cuOptGetMIPGap.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetMIPGap(cuOptSolution solution, cuopt_float_t *mip_gap_ptr) + * } + */ + public static MemorySegment cuOptGetMIPGap$address() { + return cuOptGetMIPGap.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetMIPGap(cuOptSolution solution, cuopt_float_t *mip_gap_ptr) + * } + */ + public static int cuOptGetMIPGap(MemorySegment solution, MemorySegment mip_gap_ptr) { + var mh$ = cuOptGetMIPGap.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetMIPGap", solution, mip_gap_ptr); + } + return (int)mh$.invokeExact(solution, mip_gap_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetSolutionBound { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetSolutionBound"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetSolutionBound(cuOptSolution solution, cuopt_float_t *solution_bound_ptr) + * } + */ + public static FunctionDescriptor cuOptGetSolutionBound$descriptor() { + return cuOptGetSolutionBound.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetSolutionBound(cuOptSolution solution, cuopt_float_t *solution_bound_ptr) + * } + */ + public static MethodHandle cuOptGetSolutionBound$handle() { + return cuOptGetSolutionBound.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetSolutionBound(cuOptSolution solution, cuopt_float_t *solution_bound_ptr) + * } + */ + public static MemorySegment cuOptGetSolutionBound$address() { + return cuOptGetSolutionBound.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetSolutionBound(cuOptSolution solution, cuopt_float_t *solution_bound_ptr) + * } + */ + public static int cuOptGetSolutionBound(MemorySegment solution, MemorySegment solution_bound_ptr) { + var mh$ = cuOptGetSolutionBound.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetSolutionBound", solution, solution_bound_ptr); + } + return (int)mh$.invokeExact(solution, solution_bound_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetDualSolution { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetDualSolution"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetDualSolution(cuOptSolution solution, cuopt_float_t *dual_solution_ptr) + * } + */ + public static FunctionDescriptor cuOptGetDualSolution$descriptor() { + return cuOptGetDualSolution.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetDualSolution(cuOptSolution solution, cuopt_float_t *dual_solution_ptr) + * } + */ + public static MethodHandle cuOptGetDualSolution$handle() { + return cuOptGetDualSolution.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetDualSolution(cuOptSolution solution, cuopt_float_t *dual_solution_ptr) + * } + */ + public static MemorySegment cuOptGetDualSolution$address() { + return cuOptGetDualSolution.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetDualSolution(cuOptSolution solution, cuopt_float_t *dual_solution_ptr) + * } + */ + public static int cuOptGetDualSolution(MemorySegment solution, MemorySegment dual_solution_ptr) { + var mh$ = cuOptGetDualSolution.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetDualSolution", solution, dual_solution_ptr); + } + return (int)mh$.invokeExact(solution, dual_solution_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetDualObjectiveValue { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetDualObjectiveValue"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetDualObjectiveValue(cuOptSolution solution, cuopt_float_t *dual_objective_value_ptr) + * } + */ + public static FunctionDescriptor cuOptGetDualObjectiveValue$descriptor() { + return cuOptGetDualObjectiveValue.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetDualObjectiveValue(cuOptSolution solution, cuopt_float_t *dual_objective_value_ptr) + * } + */ + public static MethodHandle cuOptGetDualObjectiveValue$handle() { + return cuOptGetDualObjectiveValue.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetDualObjectiveValue(cuOptSolution solution, cuopt_float_t *dual_objective_value_ptr) + * } + */ + public static MemorySegment cuOptGetDualObjectiveValue$address() { + return cuOptGetDualObjectiveValue.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetDualObjectiveValue(cuOptSolution solution, cuopt_float_t *dual_objective_value_ptr) + * } + */ + public static int cuOptGetDualObjectiveValue(MemorySegment solution, MemorySegment dual_objective_value_ptr) { + var mh$ = cuOptGetDualObjectiveValue.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetDualObjectiveValue", solution, dual_objective_value_ptr); + } + return (int)mh$.invokeExact(solution, dual_objective_value_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class cuOptGetReducedCosts { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + cuopt_c_h.C_INT, + cuopt_c_h.C_POINTER, + cuopt_c_h.C_POINTER + ); + + public static final MemorySegment ADDR = cuopt_c_h.findOrThrow("cuOptGetReducedCosts"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetReducedCosts(cuOptSolution solution, cuopt_float_t *reduced_cost_ptr) + * } + */ + public static FunctionDescriptor cuOptGetReducedCosts$descriptor() { + return cuOptGetReducedCosts.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetReducedCosts(cuOptSolution solution, cuopt_float_t *reduced_cost_ptr) + * } + */ + public static MethodHandle cuOptGetReducedCosts$handle() { + return cuOptGetReducedCosts.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * cuopt_int_t cuOptGetReducedCosts(cuOptSolution solution, cuopt_float_t *reduced_cost_ptr) + * } + */ + public static MemorySegment cuOptGetReducedCosts$address() { + return cuOptGetReducedCosts.ADDR; + } + + /** + * {@snippet lang=c : + * cuopt_int_t cuOptGetReducedCosts(cuOptSolution solution, cuopt_float_t *reduced_cost_ptr) + * } + */ + public static int cuOptGetReducedCosts(MemorySegment solution, MemorySegment reduced_cost_ptr) { + var mh$ = cuOptGetReducedCosts.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("cuOptGetReducedCosts", solution, reduced_cost_ptr); + } + return (int)mh$.invokeExact(solution, reduced_cost_ptr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + private static final long _POSIX_C_SOURCE = 200809L; + /** + * {@snippet lang=c : + * #define _POSIX_C_SOURCE 200809 + * } + */ + public static long _POSIX_C_SOURCE() { + return _POSIX_C_SOURCE; + } + private static final int __TIMESIZE = (int)64L; + /** + * {@snippet lang=c : + * #define __TIMESIZE 64 + * } + */ + public static int __TIMESIZE() { + return __TIMESIZE; + } + private static final long __STDC_IEC_60559_BFP__ = 201404L; + /** + * {@snippet lang=c : + * #define __STDC_IEC_60559_BFP__ 201404 + * } + */ + public static long __STDC_IEC_60559_BFP__() { + return __STDC_IEC_60559_BFP__; + } + private static final long __STDC_IEC_60559_COMPLEX__ = 201404L; + /** + * {@snippet lang=c : + * #define __STDC_IEC_60559_COMPLEX__ 201404 + * } + */ + public static long __STDC_IEC_60559_COMPLEX__() { + return __STDC_IEC_60559_COMPLEX__; + } + private static final long __STDC_ISO_10646__ = 201706L; + /** + * {@snippet lang=c : + * #define __STDC_ISO_10646__ 201706 + * } + */ + public static long __STDC_ISO_10646__() { + return __STDC_ISO_10646__; + } + private static final int __HAVE_DISTINCT_FLOAT16 = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_DISTINCT_FLOAT16 0 + * } + */ + public static int __HAVE_DISTINCT_FLOAT16() { + return __HAVE_DISTINCT_FLOAT16; + } + private static final int __HAVE_DISTINCT_FLOAT128X = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_DISTINCT_FLOAT128X 0 + * } + */ + public static int __HAVE_DISTINCT_FLOAT128X() { + return __HAVE_DISTINCT_FLOAT128X; + } + private static final int __HAVE_FLOAT128_UNLIKE_LDBL = (int)0L; + /** + * {@snippet lang=c : + * #define __HAVE_FLOAT128_UNLIKE_LDBL 0 + * } + */ + public static int __HAVE_FLOAT128_UNLIKE_LDBL() { + return __HAVE_FLOAT128_UNLIKE_LDBL; + } + private static final double HUGE_VAL = Double.valueOf("Infinity"); + /** + * {@snippet lang=c : + * #define HUGE_VAL Infinity + * } + */ + public static double HUGE_VAL() { + return HUGE_VAL; + } + private static final float HUGE_VALF = Float.valueOf("Infinity"); + /** + * {@snippet lang=c : + * #define HUGE_VALF Infinity + * } + */ + public static float HUGE_VALF() { + return HUGE_VALF; + } + private static final float INFINITY = Float.valueOf("Infinity"); + /** + * {@snippet lang=c : + * #define INFINITY Infinity + * } + */ + public static float INFINITY() { + return INFINITY; + } + private static final float NAN = Float.valueOf("NaN"); + /** + * {@snippet lang=c : + * #define NAN NaN + * } + */ + public static float NAN() { + return NAN; + } + private static final int __GLIBC_FLT_EVAL_METHOD = (int)0L; + /** + * {@snippet lang=c : + * #define __GLIBC_FLT_EVAL_METHOD 0 + * } + */ + public static int __GLIBC_FLT_EVAL_METHOD() { + return __GLIBC_FLT_EVAL_METHOD; + } + private static final int FP_ILOGB0 = (int)-2147483648L; + /** + * {@snippet lang=c : + * #define FP_ILOGB0 -2147483648 + * } + */ + public static int FP_ILOGB0() { + return FP_ILOGB0; + } + private static final int FP_ILOGBNAN = (int)-2147483648L; + /** + * {@snippet lang=c : + * #define FP_ILOGBNAN -2147483648 + * } + */ + public static int FP_ILOGBNAN() { + return FP_ILOGBNAN; + } + private static final int math_errhandling = (int)3L; + /** + * {@snippet lang=c : + * #define math_errhandling 3 + * } + */ + public static int math_errhandling() { + return math_errhandling; + } + private static final double M_E = 2.718281828459045d; + /** + * {@snippet lang=c : + * #define M_E 2.718281828459045 + * } + */ + public static double M_E() { + return M_E; + } + private static final double M_LOG2E = 1.4426950408889634d; + /** + * {@snippet lang=c : + * #define M_LOG2E 1.4426950408889634 + * } + */ + public static double M_LOG2E() { + return M_LOG2E; + } + private static final double M_LOG10E = 0.4342944819032518d; + /** + * {@snippet lang=c : + * #define M_LOG10E 0.4342944819032518 + * } + */ + public static double M_LOG10E() { + return M_LOG10E; + } + private static final double M_LN2 = 0.6931471805599453d; + /** + * {@snippet lang=c : + * #define M_LN2 0.6931471805599453 + * } + */ + public static double M_LN2() { + return M_LN2; + } + private static final double M_LN10 = 2.302585092994046d; + /** + * {@snippet lang=c : + * #define M_LN10 2.302585092994046 + * } + */ + public static double M_LN10() { + return M_LN10; + } + private static final double M_PI = 3.141592653589793d; + /** + * {@snippet lang=c : + * #define M_PI 3.141592653589793 + * } + */ + public static double M_PI() { + return M_PI; + } + private static final double M_PI_2 = 1.5707963267948966d; + /** + * {@snippet lang=c : + * #define M_PI_2 1.5707963267948966 + * } + */ + public static double M_PI_2() { + return M_PI_2; + } + private static final double M_PI_4 = 0.7853981633974483d; + /** + * {@snippet lang=c : + * #define M_PI_4 0.7853981633974483 + * } + */ + public static double M_PI_4() { + return M_PI_4; + } + private static final double M_1_PI = 0.3183098861837907d; + /** + * {@snippet lang=c : + * #define M_1_PI 0.3183098861837907 + * } + */ + public static double M_1_PI() { + return M_1_PI; + } + private static final double M_2_PI = 0.6366197723675814d; + /** + * {@snippet lang=c : + * #define M_2_PI 0.6366197723675814 + * } + */ + public static double M_2_PI() { + return M_2_PI; + } + private static final double M_2_SQRTPI = 1.1283791670955126d; + /** + * {@snippet lang=c : + * #define M_2_SQRTPI 1.1283791670955126 + * } + */ + public static double M_2_SQRTPI() { + return M_2_SQRTPI; + } + private static final double M_SQRT2 = 1.4142135623730951d; + /** + * {@snippet lang=c : + * #define M_SQRT2 1.4142135623730951 + * } + */ + public static double M_SQRT2() { + return M_SQRT2; + } + private static final double M_SQRT1_2 = 0.7071067811865476d; + /** + * {@snippet lang=c : + * #define M_SQRT1_2 0.7071067811865476 + * } + */ + public static double M_SQRT1_2() { + return M_SQRT1_2; + } + /** + * {@snippet lang=c : + * #define CUOPT_ABSOLUTE_DUAL_TOLERANCE "absolute_dual_tolerance" + * } + */ + public static MemorySegment CUOPT_ABSOLUTE_DUAL_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_ABSOLUTE_DUAL_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("absolute_dual_tolerance"); + } + return Holder.CUOPT_ABSOLUTE_DUAL_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_RELATIVE_DUAL_TOLERANCE "relative_dual_tolerance" + * } + */ + public static MemorySegment CUOPT_RELATIVE_DUAL_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_RELATIVE_DUAL_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("relative_dual_tolerance"); + } + return Holder.CUOPT_RELATIVE_DUAL_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_ABSOLUTE_PRIMAL_TOLERANCE "absolute_primal_tolerance" + * } + */ + public static MemorySegment CUOPT_ABSOLUTE_PRIMAL_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_ABSOLUTE_PRIMAL_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("absolute_primal_tolerance"); + } + return Holder.CUOPT_ABSOLUTE_PRIMAL_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_RELATIVE_PRIMAL_TOLERANCE "relative_primal_tolerance" + * } + */ + public static MemorySegment CUOPT_RELATIVE_PRIMAL_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_RELATIVE_PRIMAL_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("relative_primal_tolerance"); + } + return Holder.CUOPT_RELATIVE_PRIMAL_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_ABSOLUTE_GAP_TOLERANCE "absolute_gap_tolerance" + * } + */ + public static MemorySegment CUOPT_ABSOLUTE_GAP_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_ABSOLUTE_GAP_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("absolute_gap_tolerance"); + } + return Holder.CUOPT_ABSOLUTE_GAP_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_RELATIVE_GAP_TOLERANCE "relative_gap_tolerance" + * } + */ + public static MemorySegment CUOPT_RELATIVE_GAP_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_RELATIVE_GAP_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("relative_gap_tolerance"); + } + return Holder.CUOPT_RELATIVE_GAP_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_INFEASIBILITY_DETECTION "infeasibility_detection" + * } + */ + public static MemorySegment CUOPT_INFEASIBILITY_DETECTION() { + class Holder { + static final MemorySegment CUOPT_INFEASIBILITY_DETECTION + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("infeasibility_detection"); + } + return Holder.CUOPT_INFEASIBILITY_DETECTION; + } + /** + * {@snippet lang=c : + * #define CUOPT_STRICT_INFEASIBILITY "strict_infeasibility" + * } + */ + public static MemorySegment CUOPT_STRICT_INFEASIBILITY() { + class Holder { + static final MemorySegment CUOPT_STRICT_INFEASIBILITY + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("strict_infeasibility"); + } + return Holder.CUOPT_STRICT_INFEASIBILITY; + } + /** + * {@snippet lang=c : + * #define CUOPT_PRIMAL_INFEASIBLE_TOLERANCE "primal_infeasible_tolerance" + * } + */ + public static MemorySegment CUOPT_PRIMAL_INFEASIBLE_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_PRIMAL_INFEASIBLE_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("primal_infeasible_tolerance"); + } + return Holder.CUOPT_PRIMAL_INFEASIBLE_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_DUAL_INFEASIBLE_TOLERANCE "dual_infeasible_tolerance" + * } + */ + public static MemorySegment CUOPT_DUAL_INFEASIBLE_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_DUAL_INFEASIBLE_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("dual_infeasible_tolerance"); + } + return Holder.CUOPT_DUAL_INFEASIBLE_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_ITERATION_LIMIT "iteration_limit" + * } + */ + public static MemorySegment CUOPT_ITERATION_LIMIT() { + class Holder { + static final MemorySegment CUOPT_ITERATION_LIMIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("iteration_limit"); + } + return Holder.CUOPT_ITERATION_LIMIT; + } + /** + * {@snippet lang=c : + * #define CUOPT_TIME_LIMIT "time_limit" + * } + */ + public static MemorySegment CUOPT_TIME_LIMIT() { + class Holder { + static final MemorySegment CUOPT_TIME_LIMIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("time_limit"); + } + return Holder.CUOPT_TIME_LIMIT; + } + /** + * {@snippet lang=c : + * #define CUOPT_WORK_LIMIT "work_limit" + * } + */ + public static MemorySegment CUOPT_WORK_LIMIT() { + class Holder { + static final MemorySegment CUOPT_WORK_LIMIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("work_limit"); + } + return Holder.CUOPT_WORK_LIMIT; + } + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_SOLVER_MODE "pdlp_solver_mode" + * } + */ + public static MemorySegment CUOPT_PDLP_SOLVER_MODE() { + class Holder { + static final MemorySegment CUOPT_PDLP_SOLVER_MODE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("pdlp_solver_mode"); + } + return Holder.CUOPT_PDLP_SOLVER_MODE; + } + /** + * {@snippet lang=c : + * #define CUOPT_METHOD "method" + * } + */ + public static MemorySegment CUOPT_METHOD() { + class Holder { + static final MemorySegment CUOPT_METHOD + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("method"); + } + return Holder.CUOPT_METHOD; + } + /** + * {@snippet lang=c : + * #define CUOPT_PER_CONSTRAINT_RESIDUAL "per_constraint_residual" + * } + */ + public static MemorySegment CUOPT_PER_CONSTRAINT_RESIDUAL() { + class Holder { + static final MemorySegment CUOPT_PER_CONSTRAINT_RESIDUAL + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("per_constraint_residual"); + } + return Holder.CUOPT_PER_CONSTRAINT_RESIDUAL; + } + /** + * {@snippet lang=c : + * #define CUOPT_SAVE_BEST_PRIMAL_SO_FAR "save_best_primal_so_far" + * } + */ + public static MemorySegment CUOPT_SAVE_BEST_PRIMAL_SO_FAR() { + class Holder { + static final MemorySegment CUOPT_SAVE_BEST_PRIMAL_SO_FAR + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("save_best_primal_so_far"); + } + return Holder.CUOPT_SAVE_BEST_PRIMAL_SO_FAR; + } + /** + * {@snippet lang=c : + * #define CUOPT_FIRST_PRIMAL_FEASIBLE "first_primal_feasible" + * } + */ + public static MemorySegment CUOPT_FIRST_PRIMAL_FEASIBLE() { + class Holder { + static final MemorySegment CUOPT_FIRST_PRIMAL_FEASIBLE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("first_primal_feasible"); + } + return Holder.CUOPT_FIRST_PRIMAL_FEASIBLE; + } + /** + * {@snippet lang=c : + * #define CUOPT_LOG_FILE "log_file" + * } + */ + public static MemorySegment CUOPT_LOG_FILE() { + class Holder { + static final MemorySegment CUOPT_LOG_FILE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("log_file"); + } + return Holder.CUOPT_LOG_FILE; + } + /** + * {@snippet lang=c : + * #define CUOPT_LOG_TO_CONSOLE "log_to_console" + * } + */ + public static MemorySegment CUOPT_LOG_TO_CONSOLE() { + class Holder { + static final MemorySegment CUOPT_LOG_TO_CONSOLE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("log_to_console"); + } + return Holder.CUOPT_LOG_TO_CONSOLE; + } + /** + * {@snippet lang=c : + * #define CUOPT_CROSSOVER "crossover" + * } + */ + public static MemorySegment CUOPT_CROSSOVER() { + class Holder { + static final MemorySegment CUOPT_CROSSOVER + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("crossover"); + } + return Holder.CUOPT_CROSSOVER; + } + /** + * {@snippet lang=c : + * #define CUOPT_FOLDING "folding" + * } + */ + public static MemorySegment CUOPT_FOLDING() { + class Holder { + static final MemorySegment CUOPT_FOLDING + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("folding"); + } + return Holder.CUOPT_FOLDING; + } + /** + * {@snippet lang=c : + * #define CUOPT_AUGMENTED "augmented" + * } + */ + public static MemorySegment CUOPT_AUGMENTED() { + class Holder { + static final MemorySegment CUOPT_AUGMENTED + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("augmented"); + } + return Holder.CUOPT_AUGMENTED; + } + /** + * {@snippet lang=c : + * #define CUOPT_DUALIZE "dualize" + * } + */ + public static MemorySegment CUOPT_DUALIZE() { + class Holder { + static final MemorySegment CUOPT_DUALIZE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("dualize"); + } + return Holder.CUOPT_DUALIZE; + } + /** + * {@snippet lang=c : + * #define CUOPT_ORDERING "ordering" + * } + */ + public static MemorySegment CUOPT_ORDERING() { + class Holder { + static final MemorySegment CUOPT_ORDERING + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("ordering"); + } + return Holder.CUOPT_ORDERING; + } + /** + * {@snippet lang=c : + * #define CUOPT_BARRIER_DUAL_INITIAL_POINT "barrier_dual_initial_point" + * } + */ + public static MemorySegment CUOPT_BARRIER_DUAL_INITIAL_POINT() { + class Holder { + static final MemorySegment CUOPT_BARRIER_DUAL_INITIAL_POINT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("barrier_dual_initial_point"); + } + return Holder.CUOPT_BARRIER_DUAL_INITIAL_POINT; + } + /** + * {@snippet lang=c : + * #define CUOPT_ELIMINATE_DENSE_COLUMNS "eliminate_dense_columns" + * } + */ + public static MemorySegment CUOPT_ELIMINATE_DENSE_COLUMNS() { + class Holder { + static final MemorySegment CUOPT_ELIMINATE_DENSE_COLUMNS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("eliminate_dense_columns"); + } + return Holder.CUOPT_ELIMINATE_DENSE_COLUMNS; + } + /** + * {@snippet lang=c : + * #define CUOPT_CUDSS_DETERMINISTIC "cudss_deterministic" + * } + */ + public static MemorySegment CUOPT_CUDSS_DETERMINISTIC() { + class Holder { + static final MemorySegment CUOPT_CUDSS_DETERMINISTIC + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("cudss_deterministic"); + } + return Holder.CUOPT_CUDSS_DETERMINISTIC; + } + /** + * {@snippet lang=c : + * #define CUOPT_PRESOLVE "presolve" + * } + */ + public static MemorySegment CUOPT_PRESOLVE() { + class Holder { + static final MemorySegment CUOPT_PRESOLVE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("presolve"); + } + return Holder.CUOPT_PRESOLVE; + } + /** + * {@snippet lang=c : + * #define CUOPT_DUAL_POSTSOLVE "dual_postsolve" + * } + */ + public static MemorySegment CUOPT_DUAL_POSTSOLVE() { + class Holder { + static final MemorySegment CUOPT_DUAL_POSTSOLVE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("dual_postsolve"); + } + return Holder.CUOPT_DUAL_POSTSOLVE; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_DETERMINISM_MODE "mip_determinism_mode" + * } + */ + public static MemorySegment CUOPT_MIP_DETERMINISM_MODE() { + class Holder { + static final MemorySegment CUOPT_MIP_DETERMINISM_MODE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_determinism_mode"); + } + return Holder.CUOPT_MIP_DETERMINISM_MODE; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_ABSOLUTE_TOLERANCE "mip_absolute_tolerance" + * } + */ + public static MemorySegment CUOPT_MIP_ABSOLUTE_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_MIP_ABSOLUTE_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_absolute_tolerance"); + } + return Holder.CUOPT_MIP_ABSOLUTE_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_RELATIVE_TOLERANCE "mip_relative_tolerance" + * } + */ + public static MemorySegment CUOPT_MIP_RELATIVE_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_MIP_RELATIVE_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_relative_tolerance"); + } + return Holder.CUOPT_MIP_RELATIVE_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_INTEGRALITY_TOLERANCE "mip_integrality_tolerance" + * } + */ + public static MemorySegment CUOPT_MIP_INTEGRALITY_TOLERANCE() { + class Holder { + static final MemorySegment CUOPT_MIP_INTEGRALITY_TOLERANCE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_integrality_tolerance"); + } + return Holder.CUOPT_MIP_INTEGRALITY_TOLERANCE; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_ABSOLUTE_GAP "mip_absolute_gap" + * } + */ + public static MemorySegment CUOPT_MIP_ABSOLUTE_GAP() { + class Holder { + static final MemorySegment CUOPT_MIP_ABSOLUTE_GAP + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_absolute_gap"); + } + return Holder.CUOPT_MIP_ABSOLUTE_GAP; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_RELATIVE_GAP "mip_relative_gap" + * } + */ + public static MemorySegment CUOPT_MIP_RELATIVE_GAP() { + class Holder { + static final MemorySegment CUOPT_MIP_RELATIVE_GAP + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_relative_gap"); + } + return Holder.CUOPT_MIP_RELATIVE_GAP; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HEURISTICS_ONLY "mip_heuristics_only" + * } + */ + public static MemorySegment CUOPT_MIP_HEURISTICS_ONLY() { + class Holder { + static final MemorySegment CUOPT_MIP_HEURISTICS_ONLY + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_heuristics_only"); + } + return Holder.CUOPT_MIP_HEURISTICS_ONLY; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_SCALING "mip_scaling" + * } + */ + public static MemorySegment CUOPT_MIP_SCALING() { + class Holder { + static final MemorySegment CUOPT_MIP_SCALING + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_scaling"); + } + return Holder.CUOPT_MIP_SCALING; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_PRESOLVE "mip_presolve" + * } + */ + public static MemorySegment CUOPT_MIP_PRESOLVE() { + class Holder { + static final MemorySegment CUOPT_MIP_PRESOLVE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_presolve"); + } + return Holder.CUOPT_MIP_PRESOLVE; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_RELIABILITY_BRANCHING "mip_reliability_branching" + * } + */ + public static MemorySegment CUOPT_MIP_RELIABILITY_BRANCHING() { + class Holder { + static final MemorySegment CUOPT_MIP_RELIABILITY_BRANCHING + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_reliability_branching"); + } + return Holder.CUOPT_MIP_RELIABILITY_BRANCHING; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_CUT_PASSES "mip_cut_passes" + * } + */ + public static MemorySegment CUOPT_MIP_CUT_PASSES() { + class Holder { + static final MemorySegment CUOPT_MIP_CUT_PASSES + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_cut_passes"); + } + return Holder.CUOPT_MIP_CUT_PASSES; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS "mip_mixed_integer_rounding_cuts" + * } + */ + public static MemorySegment CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS() { + class Holder { + static final MemorySegment CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_mixed_integer_rounding_cuts"); + } + return Holder.CUOPT_MIP_MIXED_INTEGER_ROUNDING_CUTS; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS "mip_mixed_integer_gomory_cuts" + * } + */ + public static MemorySegment CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS() { + class Holder { + static final MemorySegment CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_mixed_integer_gomory_cuts"); + } + return Holder.CUOPT_MIP_MIXED_INTEGER_GOMORY_CUTS; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_KNAPSACK_CUTS "mip_knapsack_cuts" + * } + */ + public static MemorySegment CUOPT_MIP_KNAPSACK_CUTS() { + class Holder { + static final MemorySegment CUOPT_MIP_KNAPSACK_CUTS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_knapsack_cuts"); + } + return Holder.CUOPT_MIP_KNAPSACK_CUTS; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_IMPLIED_BOUND_CUTS "mip_implied_bound_cuts" + * } + */ + public static MemorySegment CUOPT_MIP_IMPLIED_BOUND_CUTS() { + class Holder { + static final MemorySegment CUOPT_MIP_IMPLIED_BOUND_CUTS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_implied_bound_cuts"); + } + return Holder.CUOPT_MIP_IMPLIED_BOUND_CUTS; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_CLIQUE_CUTS "mip_clique_cuts" + * } + */ + public static MemorySegment CUOPT_MIP_CLIQUE_CUTS() { + class Holder { + static final MemorySegment CUOPT_MIP_CLIQUE_CUTS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_clique_cuts"); + } + return Holder.CUOPT_MIP_CLIQUE_CUTS; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS "mip_strong_chvatal_gomory_cuts" + * } + */ + public static MemorySegment CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS() { + class Holder { + static final MemorySegment CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_strong_chvatal_gomory_cuts"); + } + return Holder.CUOPT_MIP_STRONG_CHVATAL_GOMORY_CUTS; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_REDUCED_COST_STRENGTHENING "mip_reduced_cost_strengthening" + * } + */ + public static MemorySegment CUOPT_MIP_REDUCED_COST_STRENGTHENING() { + class Holder { + static final MemorySegment CUOPT_MIP_REDUCED_COST_STRENGTHENING + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_reduced_cost_strengthening"); + } + return Holder.CUOPT_MIP_REDUCED_COST_STRENGTHENING; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_CUT_CHANGE_THRESHOLD "mip_cut_change_threshold" + * } + */ + public static MemorySegment CUOPT_MIP_CUT_CHANGE_THRESHOLD() { + class Holder { + static final MemorySegment CUOPT_MIP_CUT_CHANGE_THRESHOLD + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_cut_change_threshold"); + } + return Holder.CUOPT_MIP_CUT_CHANGE_THRESHOLD; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_CUT_MIN_ORTHOGONALITY "mip_cut_min_orthogonality" + * } + */ + public static MemorySegment CUOPT_MIP_CUT_MIN_ORTHOGONALITY() { + class Holder { + static final MemorySegment CUOPT_MIP_CUT_MIN_ORTHOGONALITY + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_cut_min_orthogonality"); + } + return Holder.CUOPT_MIP_CUT_MIN_ORTHOGONALITY; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING "mip_batch_pdlp_strong_branching" + * } + */ + public static MemorySegment CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING() { + class Holder { + static final MemorySegment CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_batch_pdlp_strong_branching"); + } + return Holder.CUOPT_MIP_BATCH_PDLP_STRONG_BRANCHING; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_BATCH_PDLP_RELIABILITY_BRANCHING "mip_batch_pdlp_reliability_branching" + * } + */ + public static MemorySegment CUOPT_MIP_BATCH_PDLP_RELIABILITY_BRANCHING() { + class Holder { + static final MemorySegment CUOPT_MIP_BATCH_PDLP_RELIABILITY_BRANCHING + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_batch_pdlp_reliability_branching"); + } + return Holder.CUOPT_MIP_BATCH_PDLP_RELIABILITY_BRANCHING; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_STRONG_BRANCHING_SIMPLEX_ITERATION_LIMIT "mip_strong_branching_simplex_iteration_limit" + * } + */ + public static MemorySegment CUOPT_MIP_STRONG_BRANCHING_SIMPLEX_ITERATION_LIMIT() { + class Holder { + static final MemorySegment CUOPT_MIP_STRONG_BRANCHING_SIMPLEX_ITERATION_LIMIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_strong_branching_simplex_iteration_limit"); + } + return Holder.CUOPT_MIP_STRONG_BRANCHING_SIMPLEX_ITERATION_LIMIT; + } + /** + * {@snippet lang=c : + * #define CUOPT_SOLUTION_FILE "solution_file" + * } + */ + public static MemorySegment CUOPT_SOLUTION_FILE() { + class Holder { + static final MemorySegment CUOPT_SOLUTION_FILE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("solution_file"); + } + return Holder.CUOPT_SOLUTION_FILE; + } + /** + * {@snippet lang=c : + * #define CUOPT_NUM_CPU_THREADS "num_cpu_threads" + * } + */ + public static MemorySegment CUOPT_NUM_CPU_THREADS() { + class Holder { + static final MemorySegment CUOPT_NUM_CPU_THREADS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("num_cpu_threads"); + } + return Holder.CUOPT_NUM_CPU_THREADS; + } + /** + * {@snippet lang=c : + * #define CUOPT_NUM_GPUS "num_gpus" + * } + */ + public static MemorySegment CUOPT_NUM_GPUS() { + class Holder { + static final MemorySegment CUOPT_NUM_GPUS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("num_gpus"); + } + return Holder.CUOPT_NUM_GPUS; + } + /** + * {@snippet lang=c : + * #define CUOPT_USER_PROBLEM_FILE "user_problem_file" + * } + */ + public static MemorySegment CUOPT_USER_PROBLEM_FILE() { + class Holder { + static final MemorySegment CUOPT_USER_PROBLEM_FILE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("user_problem_file"); + } + return Holder.CUOPT_USER_PROBLEM_FILE; + } + /** + * {@snippet lang=c : + * #define CUOPT_PRESOLVE_FILE "presolve_file" + * } + */ + public static MemorySegment CUOPT_PRESOLVE_FILE() { + class Holder { + static final MemorySegment CUOPT_PRESOLVE_FILE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("presolve_file"); + } + return Holder.CUOPT_PRESOLVE_FILE; + } + /** + * {@snippet lang=c : + * #define CUOPT_RANDOM_SEED "random_seed" + * } + */ + public static MemorySegment CUOPT_RANDOM_SEED() { + class Holder { + static final MemorySegment CUOPT_RANDOM_SEED + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("random_seed"); + } + return Holder.CUOPT_RANDOM_SEED; + } + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_PRECISION "pdlp_precision" + * } + */ + public static MemorySegment CUOPT_PDLP_PRECISION() { + class Holder { + static final MemorySegment CUOPT_PDLP_PRECISION + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("pdlp_precision"); + } + return Holder.CUOPT_PDLP_PRECISION; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_SEMICONTINUOUS_BIG_M "mip_semi_continuous_big_m" + * } + */ + public static MemorySegment CUOPT_MIP_SEMICONTINUOUS_BIG_M() { + class Holder { + static final MemorySegment CUOPT_MIP_SEMICONTINUOUS_BIG_M + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_semi_continuous_big_m"); + } + return Holder.CUOPT_MIP_SEMICONTINUOUS_BIG_M; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_POPULATION_SIZE "mip_hyper_heuristic_population_size" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_POPULATION_SIZE() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_POPULATION_SIZE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_population_size"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_POPULATION_SIZE; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_NUM_CPUFJ_THREADS "mip_hyper_heuristic_num_cpufj_threads" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_NUM_CPUFJ_THREADS() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_NUM_CPUFJ_THREADS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_num_cpufj_threads"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_NUM_CPUFJ_THREADS; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_PRESOLVE_TIME_RATIO "mip_hyper_heuristic_presolve_time_ratio" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_PRESOLVE_TIME_RATIO() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_PRESOLVE_TIME_RATIO + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_presolve_time_ratio"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_PRESOLVE_TIME_RATIO; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_PRESOLVE_MAX_TIME "mip_hyper_heuristic_presolve_max_time" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_PRESOLVE_MAX_TIME() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_PRESOLVE_MAX_TIME + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_presolve_max_time"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_PRESOLVE_MAX_TIME; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_ROOT_LP_TIME_RATIO "mip_hyper_heuristic_root_lp_time_ratio" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_ROOT_LP_TIME_RATIO() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_ROOT_LP_TIME_RATIO + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_root_lp_time_ratio"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_ROOT_LP_TIME_RATIO; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_ROOT_LP_MAX_TIME "mip_hyper_heuristic_root_lp_max_time" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_ROOT_LP_MAX_TIME() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_ROOT_LP_MAX_TIME + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_root_lp_max_time"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_ROOT_LP_MAX_TIME; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_RINS_TIME_LIMIT "mip_hyper_heuristic_rins_time_limit" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RINS_TIME_LIMIT() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RINS_TIME_LIMIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_rins_time_limit"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_RINS_TIME_LIMIT; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_RINS_MAX_TIME_LIMIT "mip_hyper_heuristic_rins_max_time_limit" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RINS_MAX_TIME_LIMIT() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RINS_MAX_TIME_LIMIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_rins_max_time_limit"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_RINS_MAX_TIME_LIMIT; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_RINS_FIX_RATE "mip_hyper_heuristic_rins_fix_rate" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RINS_FIX_RATE() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RINS_FIX_RATE + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_rins_fix_rate"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_RINS_FIX_RATE; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_STAGNATION_TRIGGER "mip_hyper_heuristic_stagnation_trigger" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_STAGNATION_TRIGGER() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_STAGNATION_TRIGGER + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_stagnation_trigger"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_STAGNATION_TRIGGER; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_MAX_ITERS_WITHOUT_IMPROVEMENT "mip_hyper_heuristic_max_iterations_without_improvement" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_MAX_ITERS_WITHOUT_IMPROVEMENT() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_MAX_ITERS_WITHOUT_IMPROVEMENT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_max_iterations_without_improvement"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_MAX_ITERS_WITHOUT_IMPROVEMENT; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_INITIAL_INFEASIBILITY_WEIGHT "mip_hyper_heuristic_initial_infeasibility_weight" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_INITIAL_INFEASIBILITY_WEIGHT() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_INITIAL_INFEASIBILITY_WEIGHT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_initial_infeasibility_weight"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_INITIAL_INFEASIBILITY_WEIGHT; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_N_OF_MINIMUMS_FOR_EXIT "mip_hyper_heuristic_n_of_minimums_for_exit" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_N_OF_MINIMUMS_FOR_EXIT() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_N_OF_MINIMUMS_FOR_EXIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_n_of_minimums_for_exit"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_N_OF_MINIMUMS_FOR_EXIT; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_ENABLED_RECOMBINERS "mip_hyper_heuristic_enabled_recombiners" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_ENABLED_RECOMBINERS() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_ENABLED_RECOMBINERS + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_enabled_recombiners"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_ENABLED_RECOMBINERS; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_CYCLE_DETECTION_LENGTH "mip_hyper_heuristic_cycle_detection_length" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_CYCLE_DETECTION_LENGTH() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_CYCLE_DETECTION_LENGTH + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_cycle_detection_length"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_CYCLE_DETECTION_LENGTH; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_RELAXED_LP_TIME_LIMIT "mip_hyper_heuristic_relaxed_lp_time_limit" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RELAXED_LP_TIME_LIMIT() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RELAXED_LP_TIME_LIMIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_relaxed_lp_time_limit"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_RELAXED_LP_TIME_LIMIT; + } + /** + * {@snippet lang=c : + * #define CUOPT_MIP_HYPER_HEURISTIC_RELATED_VARS_TIME_LIMIT "mip_hyper_heuristic_related_vars_time_limit" + * } + */ + public static MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RELATED_VARS_TIME_LIMIT() { + class Holder { + static final MemorySegment CUOPT_MIP_HYPER_HEURISTIC_RELATED_VARS_TIME_LIMIT + = cuopt_c_h.LIBRARY_ARENA.allocateFrom("mip_hyper_heuristic_related_vars_time_limit"); + } + return Holder.CUOPT_MIP_HYPER_HEURISTIC_RELATED_VARS_TIME_LIMIT; + } + private static final int CUOPT_MAXIMIZE = (int)-1L; + /** + * {@snippet lang=c : + * #define CUOPT_MAXIMIZE -1 + * } + */ + public static int CUOPT_MAXIMIZE() { + return CUOPT_MAXIMIZE; + } + private static final int CUOPT_LESS_THAN = (int)76L; + /** + * {@snippet lang=c : + * #define CUOPT_LESS_THAN 76 + * } + */ + public static int CUOPT_LESS_THAN() { + return CUOPT_LESS_THAN; + } + private static final int CUOPT_GREATER_THAN = (int)71L; + /** + * {@snippet lang=c : + * #define CUOPT_GREATER_THAN 71 + * } + */ + public static int CUOPT_GREATER_THAN() { + return CUOPT_GREATER_THAN; + } + private static final int CUOPT_EQUAL = (int)69L; + /** + * {@snippet lang=c : + * #define CUOPT_EQUAL 69 + * } + */ + public static int CUOPT_EQUAL() { + return CUOPT_EQUAL; + } + private static final int CUOPT_CONTINUOUS = (int)67L; + /** + * {@snippet lang=c : + * #define CUOPT_CONTINUOUS 67 + * } + */ + public static int CUOPT_CONTINUOUS() { + return CUOPT_CONTINUOUS; + } + private static final int CUOPT_INTEGER = (int)73L; + /** + * {@snippet lang=c : + * #define CUOPT_INTEGER 73 + * } + */ + public static int CUOPT_INTEGER() { + return CUOPT_INTEGER; + } + private static final float CUOPT_INFINITY = Float.valueOf("Infinity"); + /** + * {@snippet lang=c : + * #define CUOPT_INFINITY Infinity + * } + */ + public static float CUOPT_INFINITY() { + return CUOPT_INFINITY; + } + private static final int CUOPT_PDLP_DEFAULT_PRECISION = (int)-1L; + /** + * {@snippet lang=c : + * #define CUOPT_PDLP_DEFAULT_PRECISION -1 + * } + */ + public static int CUOPT_PDLP_DEFAULT_PRECISION() { + return CUOPT_PDLP_DEFAULT_PRECISION; + } + private static final int CUOPT_PRESOLVE_DEFAULT = (int)-1L; + /** + * {@snippet lang=c : + * #define CUOPT_PRESOLVE_DEFAULT -1 + * } + */ + public static int CUOPT_PRESOLVE_DEFAULT() { + return CUOPT_PRESOLVE_DEFAULT; + } + private static final int __WCHAR_MAX = (int)2147483647L; + /** + * {@snippet lang=c : + * #define __WCHAR_MAX 2147483647 + * } + */ + public static int __WCHAR_MAX() { + return __WCHAR_MAX; + } + private static final int __WCHAR_MIN = (int)-2147483648L; + /** + * {@snippet lang=c : + * #define __WCHAR_MIN -2147483648 + * } + */ + public static int __WCHAR_MIN() { + return __WCHAR_MIN; + } + private static final int INT8_MIN = (int)-128L; + /** + * {@snippet lang=c : + * #define INT8_MIN -128 + * } + */ + public static int INT8_MIN() { + return INT8_MIN; + } + private static final int INT16_MIN = (int)-32768L; + /** + * {@snippet lang=c : + * #define INT16_MIN -32768 + * } + */ + public static int INT16_MIN() { + return INT16_MIN; + } + private static final int INT32_MIN = (int)-2147483648L; + /** + * {@snippet lang=c : + * #define INT32_MIN -2147483648 + * } + */ + public static int INT32_MIN() { + return INT32_MIN; + } + private static final long INT64_MIN = -9223372036854775808L; + /** + * {@snippet lang=c : + * #define INT64_MIN -9223372036854775808 + * } + */ + public static long INT64_MIN() { + return INT64_MIN; + } + private static final int INT8_MAX = (int)127L; + /** + * {@snippet lang=c : + * #define INT8_MAX 127 + * } + */ + public static int INT8_MAX() { + return INT8_MAX; + } + private static final int INT16_MAX = (int)32767L; + /** + * {@snippet lang=c : + * #define INT16_MAX 32767 + * } + */ + public static int INT16_MAX() { + return INT16_MAX; + } + private static final int INT32_MAX = (int)2147483647L; + /** + * {@snippet lang=c : + * #define INT32_MAX 2147483647 + * } + */ + public static int INT32_MAX() { + return INT32_MAX; + } + private static final long INT64_MAX = 9223372036854775807L; + /** + * {@snippet lang=c : + * #define INT64_MAX 9223372036854775807 + * } + */ + public static long INT64_MAX() { + return INT64_MAX; + } + private static final int UINT8_MAX = (int)255L; + /** + * {@snippet lang=c : + * #define UINT8_MAX 255 + * } + */ + public static int UINT8_MAX() { + return UINT8_MAX; + } + private static final int UINT16_MAX = (int)65535L; + /** + * {@snippet lang=c : + * #define UINT16_MAX 65535 + * } + */ + public static int UINT16_MAX() { + return UINT16_MAX; + } + private static final int UINT32_MAX = (int)4294967295L; + /** + * {@snippet lang=c : + * #define UINT32_MAX 4294967295 + * } + */ + public static int UINT32_MAX() { + return UINT32_MAX; + } + private static final long UINT64_MAX = -1L; + /** + * {@snippet lang=c : + * #define UINT64_MAX -1 + * } + */ + public static long UINT64_MAX() { + return UINT64_MAX; + } + private static final int INT_LEAST8_MIN = (int)-128L; + /** + * {@snippet lang=c : + * #define INT_LEAST8_MIN -128 + * } + */ + public static int INT_LEAST8_MIN() { + return INT_LEAST8_MIN; + } + private static final int INT_LEAST16_MIN = (int)-32768L; + /** + * {@snippet lang=c : + * #define INT_LEAST16_MIN -32768 + * } + */ + public static int INT_LEAST16_MIN() { + return INT_LEAST16_MIN; + } + private static final int INT_LEAST32_MIN = (int)-2147483648L; + /** + * {@snippet lang=c : + * #define INT_LEAST32_MIN -2147483648 + * } + */ + public static int INT_LEAST32_MIN() { + return INT_LEAST32_MIN; + } + private static final long INT_LEAST64_MIN = -9223372036854775808L; + /** + * {@snippet lang=c : + * #define INT_LEAST64_MIN -9223372036854775808 + * } + */ + public static long INT_LEAST64_MIN() { + return INT_LEAST64_MIN; + } + private static final int INT_LEAST8_MAX = (int)127L; + /** + * {@snippet lang=c : + * #define INT_LEAST8_MAX 127 + * } + */ + public static int INT_LEAST8_MAX() { + return INT_LEAST8_MAX; + } + private static final int INT_LEAST16_MAX = (int)32767L; + /** + * {@snippet lang=c : + * #define INT_LEAST16_MAX 32767 + * } + */ + public static int INT_LEAST16_MAX() { + return INT_LEAST16_MAX; + } + private static final int INT_LEAST32_MAX = (int)2147483647L; + /** + * {@snippet lang=c : + * #define INT_LEAST32_MAX 2147483647 + * } + */ + public static int INT_LEAST32_MAX() { + return INT_LEAST32_MAX; + } + private static final long INT_LEAST64_MAX = 9223372036854775807L; + /** + * {@snippet lang=c : + * #define INT_LEAST64_MAX 9223372036854775807 + * } + */ + public static long INT_LEAST64_MAX() { + return INT_LEAST64_MAX; + } + private static final int UINT_LEAST8_MAX = (int)255L; + /** + * {@snippet lang=c : + * #define UINT_LEAST8_MAX 255 + * } + */ + public static int UINT_LEAST8_MAX() { + return UINT_LEAST8_MAX; + } + private static final int UINT_LEAST16_MAX = (int)65535L; + /** + * {@snippet lang=c : + * #define UINT_LEAST16_MAX 65535 + * } + */ + public static int UINT_LEAST16_MAX() { + return UINT_LEAST16_MAX; + } + private static final int UINT_LEAST32_MAX = (int)4294967295L; + /** + * {@snippet lang=c : + * #define UINT_LEAST32_MAX 4294967295 + * } + */ + public static int UINT_LEAST32_MAX() { + return UINT_LEAST32_MAX; + } + private static final long UINT_LEAST64_MAX = -1L; + /** + * {@snippet lang=c : + * #define UINT_LEAST64_MAX -1 + * } + */ + public static long UINT_LEAST64_MAX() { + return UINT_LEAST64_MAX; + } + private static final int INT_FAST8_MIN = (int)-128L; + /** + * {@snippet lang=c : + * #define INT_FAST8_MIN -128 + * } + */ + public static int INT_FAST8_MIN() { + return INT_FAST8_MIN; + } + private static final long INT_FAST16_MIN = -9223372036854775808L; + /** + * {@snippet lang=c : + * #define INT_FAST16_MIN -9223372036854775808 + * } + */ + public static long INT_FAST16_MIN() { + return INT_FAST16_MIN; + } + private static final long INT_FAST32_MIN = -9223372036854775808L; + /** + * {@snippet lang=c : + * #define INT_FAST32_MIN -9223372036854775808 + * } + */ + public static long INT_FAST32_MIN() { + return INT_FAST32_MIN; + } + private static final long INT_FAST64_MIN = -9223372036854775808L; + /** + * {@snippet lang=c : + * #define INT_FAST64_MIN -9223372036854775808 + * } + */ + public static long INT_FAST64_MIN() { + return INT_FAST64_MIN; + } + private static final int INT_FAST8_MAX = (int)127L; + /** + * {@snippet lang=c : + * #define INT_FAST8_MAX 127 + * } + */ + public static int INT_FAST8_MAX() { + return INT_FAST8_MAX; + } + private static final long INT_FAST16_MAX = 9223372036854775807L; + /** + * {@snippet lang=c : + * #define INT_FAST16_MAX 9223372036854775807 + * } + */ + public static long INT_FAST16_MAX() { + return INT_FAST16_MAX; + } + private static final long INT_FAST32_MAX = 9223372036854775807L; + /** + * {@snippet lang=c : + * #define INT_FAST32_MAX 9223372036854775807 + * } + */ + public static long INT_FAST32_MAX() { + return INT_FAST32_MAX; + } + private static final long INT_FAST64_MAX = 9223372036854775807L; + /** + * {@snippet lang=c : + * #define INT_FAST64_MAX 9223372036854775807 + * } + */ + public static long INT_FAST64_MAX() { + return INT_FAST64_MAX; + } + private static final int UINT_FAST8_MAX = (int)255L; + /** + * {@snippet lang=c : + * #define UINT_FAST8_MAX 255 + * } + */ + public static int UINT_FAST8_MAX() { + return UINT_FAST8_MAX; + } + private static final long UINT_FAST16_MAX = -1L; + /** + * {@snippet lang=c : + * #define UINT_FAST16_MAX -1 + * } + */ + public static long UINT_FAST16_MAX() { + return UINT_FAST16_MAX; + } + private static final long UINT_FAST32_MAX = -1L; + /** + * {@snippet lang=c : + * #define UINT_FAST32_MAX -1 + * } + */ + public static long UINT_FAST32_MAX() { + return UINT_FAST32_MAX; + } + private static final long UINT_FAST64_MAX = -1L; + /** + * {@snippet lang=c : + * #define UINT_FAST64_MAX -1 + * } + */ + public static long UINT_FAST64_MAX() { + return UINT_FAST64_MAX; + } + private static final long INTPTR_MIN = -9223372036854775808L; + /** + * {@snippet lang=c : + * #define INTPTR_MIN -9223372036854775808 + * } + */ + public static long INTPTR_MIN() { + return INTPTR_MIN; + } + private static final long INTPTR_MAX = 9223372036854775807L; + /** + * {@snippet lang=c : + * #define INTPTR_MAX 9223372036854775807 + * } + */ + public static long INTPTR_MAX() { + return INTPTR_MAX; + } + private static final long UINTPTR_MAX = -1L; + /** + * {@snippet lang=c : + * #define UINTPTR_MAX -1 + * } + */ + public static long UINTPTR_MAX() { + return UINTPTR_MAX; + } + private static final long INTMAX_MIN = -9223372036854775808L; + /** + * {@snippet lang=c : + * #define INTMAX_MIN -9223372036854775808 + * } + */ + public static long INTMAX_MIN() { + return INTMAX_MIN; + } + private static final long INTMAX_MAX = 9223372036854775807L; + /** + * {@snippet lang=c : + * #define INTMAX_MAX 9223372036854775807 + * } + */ + public static long INTMAX_MAX() { + return INTMAX_MAX; + } + private static final long UINTMAX_MAX = -1L; + /** + * {@snippet lang=c : + * #define UINTMAX_MAX -1 + * } + */ + public static long UINTMAX_MAX() { + return UINTMAX_MAX; + } + private static final long PTRDIFF_MIN = -9223372036854775808L; + /** + * {@snippet lang=c : + * #define PTRDIFF_MIN -9223372036854775808 + * } + */ + public static long PTRDIFF_MIN() { + return PTRDIFF_MIN; + } + private static final long PTRDIFF_MAX = 9223372036854775807L; + /** + * {@snippet lang=c : + * #define PTRDIFF_MAX 9223372036854775807 + * } + */ + public static long PTRDIFF_MAX() { + return PTRDIFF_MAX; + } + private static final int SIG_ATOMIC_MIN = (int)-2147483648L; + /** + * {@snippet lang=c : + * #define SIG_ATOMIC_MIN -2147483648 + * } + */ + public static int SIG_ATOMIC_MIN() { + return SIG_ATOMIC_MIN; + } + private static final int SIG_ATOMIC_MAX = (int)2147483647L; + /** + * {@snippet lang=c : + * #define SIG_ATOMIC_MAX 2147483647 + * } + */ + public static int SIG_ATOMIC_MAX() { + return SIG_ATOMIC_MAX; + } + private static final long SIZE_MAX = -1L; + /** + * {@snippet lang=c : + * #define SIZE_MAX -1 + * } + */ + public static long SIZE_MAX() { + return SIZE_MAX; + } + private static final int WCHAR_MIN = (int)-2147483648L; + /** + * {@snippet lang=c : + * #define WCHAR_MIN -2147483648 + * } + */ + public static int WCHAR_MIN() { + return WCHAR_MIN; + } + private static final int WCHAR_MAX = (int)2147483647L; + /** + * {@snippet lang=c : + * #define WCHAR_MAX 2147483647 + * } + */ + public static int WCHAR_MAX() { + return WCHAR_MAX; + } + private static final int WINT_MIN = (int)0L; + /** + * {@snippet lang=c : + * #define WINT_MIN 0 + * } + */ + public static int WINT_MIN() { + return WINT_MIN; + } + private static final int WINT_MAX = (int)4294967295L; + /** + * {@snippet lang=c : + * #define WINT_MAX 4294967295 + * } + */ + public static int WINT_MAX() { + return WINT_MAX; + } +} diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverIT.java similarity index 96% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverTest.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverIT.java index 6787761ca8..00d53d65ee 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverTest.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/SolverIT.java @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test; -class SolverTest { +class SolverIT { @Test void getVersionReturnsNonEmptyString() { diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java similarity index 99% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverTest.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java index 519e8850d1..c1cd229650 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverTest.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java @@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test; -class LpSolverTest { +class LpSolverIT { /** * Minimal LP that mirrors the cuOpt Python LP solver test in diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java similarity index 98% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverTest.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java index a12de55ae1..ba699ad5c6 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverTest.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; -class MilpSolverTest { +class MilpSolverIT { @Test void simple_knapsack_binary_milp() { diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java similarity index 98% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverTest.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java index c36268897c..1d27e49006 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverTest.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; -class QpSolverTest { +class QpSolverIT { /** * Mirrors cuOpt Python {@code test_qp.py::test_solver}: diff --git a/java/panama-bindings/generate-bindings.sh b/java/panama-bindings/generate-bindings.sh index 624c59632e..b334bdf4a0 100755 --- a/java/panama-bindings/generate-bindings.sh +++ b/java/panama-bindings/generate-bindings.sh @@ -72,6 +72,8 @@ jextract \ --include-dir "${CUDA_INCLUDE_DIR}" \ --output "${OUTPUT_DIR}" \ --target-package "${TARGET_PACKAGE}" \ + --header-class-name cuopt_c_h \ + --use-system-load-library \ --library cuopt \ "${CURDIR}/headers.h" From 904d85566dc83a75c2b252328730fd315c04fb6e Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Mon, 11 May 2026 16:11:13 -0500 Subject: [PATCH 06/28] fix generation --- java/panama-bindings/generate-bindings.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java/panama-bindings/generate-bindings.sh b/java/panama-bindings/generate-bindings.sh index b334bdf4a0..3674ea52c7 100755 --- a/java/panama-bindings/generate-bindings.sh +++ b/java/panama-bindings/generate-bindings.sh @@ -77,5 +77,15 @@ jextract \ --library cuopt \ "${CURDIR}/headers.h" +# Normalize each generated file to end with exactly one trailing newline, +# matching pre-commit's end-of-file-fixer. jextract output is inconsistent +# (sometimes 0, sometimes 2 trailing newlines); without this the drift gate +# fails after pre-commit rewrites the committed files. +for f in "${PANAMA_DIR}"/*.java; do + [[ -f "$f" ]] || continue + content="$(cat "$f")" + printf '%s\n' "$content" > "$f" +done + echo "Panama bindings regenerated at:" echo " ${PANAMA_DIR}" From 1ac4434cd4f7671033397cfea7c52b47b4afba2c Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 09:56:34 -0500 Subject: [PATCH 07/28] java: add arm64 build support Plumbs arm64 through the build and CI pipelines: - supported-platforms.properties: flip linux-aarch64=true. - generate-bindings.sh: detect uname -m and select matching jextract tarball (linux-aarch64 confirmed available on download.java.net) and CUDA include subdir (targets/aarch64-linux/include). - java/build.sh + ci/build_java.sh: add UNIT_TESTS_ONLY mode for the arm64 CPU runner, which has no GPU and so must skip integration tests. - ci/build_java.sh: drop the stale fail-fast jextract-availability check; auto-download in generate-bindings.sh now handles it. - pr.yaml: add conda-java-build-arm64-matrix + conda-java-build-arm64 jobs on linux-arm64-cpu16, building the JAR and running unit tests. amd64 keeps full IT on gpu-l4-latest-1. - build.yaml: add java-build-arm64 sibling job for main/release/tag. IT stays on amd64 until an arm64 GPU runner is wired into rapidsai/shared-workflows; flip --unit-tests-only to --run-java-tests and update the node_type when that lands. --- .github/workflows/build.yaml | 23 +++++++++++-- .github/workflows/pr.yaml | 34 +++++++++++++++++-- ci/build_java.sh | 33 ++++++++++-------- java/build.sh | 5 +++ .../cuopt/supported-platforms.properties | 2 +- java/panama-bindings/generate-bindings.sh | 26 ++++++++++---- 6 files changed, 94 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 60e7857cc9..2202d8ae7d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -184,9 +184,8 @@ jobs: container_image: "rapidsai/ci-conda:26.06-latest" script: "ci/build_docs.sh" java-build: - # Build cuopt-java JAR for main / release-branch / tag pushes. - # amd64-only initially; arm64 build planned once jextract is in the - # arm64 CI image. + # Build cuopt-java JAR (amd64) for main / release-branch / tag pushes. + # Integration tests are not run here — they live in test.yaml. needs: [cpp-build] secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main @@ -201,6 +200,24 @@ jobs: artifact-name: "cuopt-java" container_image: "rapidsai/ci-conda:26.06-latest" script: "ci/build_java.sh" + java-build-arm64: + # Build cuopt-java JAR (arm64) for main / release-branch / tag pushes. + # CPU-only runner; integration tests stay on amd64 (no arm64 GPU + # runner wired in yet). + needs: [cpp-build] + secrets: inherit + uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main + with: + build_type: ${{ inputs.build_type || 'branch' }} + node_type: "linux-arm64-cpu16" + sha: ${{ inputs.sha }} + branch: ${{ inputs.branch }} + date: ${{ inputs.date }} + arch: "arm64" + file_to_upload: "java/cuopt-java/target/" + artifact-name: "cuopt-java-arm64" + container_image: "rapidsai/ci-conda:26.06-latest" + script: "ci/build_java.sh" wheel-build-cuopt-sh-client: secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 8a2292c61c..bf92d856ea 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -23,6 +23,7 @@ jobs: - conda-cpp-build - conda-cpp-tests - conda-java-build-and-tests + - conda-java-build-arm64 - conda-python-build - conda-python-tests - docs-build @@ -404,9 +405,10 @@ jobs: script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} conda-java-build-and-tests-matrix: - # Derives the matrix from conda-cpp-build, filtered to amd64 (matches - # cuvs pattern). arm64 build support is planned but blocked on jextract - # availability in the arm64 CI image. + # Derives the matrix from conda-cpp-build, filtered to amd64 because + # integration tests need a GPU runner and only the amd64 GPU runner + # (gpu-l4-latest-1) is currently wired up. arm64 builds + unit tests + # are handled by the conda-java-build-arm64 job below. needs: [conda-cpp-build, changed-files] if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main @@ -429,6 +431,32 @@ jobs: script: "ci/test_java.sh" file_to_upload: "java/cuopt-java/target/" artifact-name: "cuopt-java-cuda${{ needs.conda-java-build-and-tests-matrix.outputs.CUDA_VER }}" + conda-java-build-arm64-matrix: + # Matrix for the arm64 Java build, filtered to arm64 rows of + # conda-cpp-build. Sibling of conda-java-build-and-tests-matrix + # which handles amd64. + needs: [conda-cpp-build, changed-files] + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java + uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main + with: + build_type: pull-request + matrix_name: conda-cpp-build + matrix_filter: 'map(select(.ARCH == "arm64"))' + conda-java-build-arm64: + # Build the JAR + run unit tests on arm64. Integration tests need a + # GPU and the arm64 GPU runner isn't wired in yet, so IT continues + # to run on amd64 only (conda-java-build-and-tests above). + needs: conda-java-build-arm64-matrix + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java + secrets: inherit + uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main + with: + build_type: pull-request + node_type: "linux-arm64-cpu16" + arch: "arm64" + script: "ci/build_java.sh --unit-tests-only" + file_to_upload: "java/cuopt-java/target/" + artifact-name: "cuopt-java-arm64-cuda${{ needs.conda-java-build-arm64-matrix.outputs.CUDA_VER }}" conda-python-build: needs: [conda-cpp-build, compute-matrix-filters, changed-files] # Consumed by conda-python-tests and docs-build. diff --git a/ci/build_java.sh b/ci/build_java.sh index e9f0cfefb2..98fdf4dbc5 100755 --- a/ci/build_java.sh +++ b/ci/build_java.sh @@ -5,8 +5,9 @@ # Build cuopt-java in CI. # # Usage: -# ci/build_java.sh # build only, skip tests -# ci/build_java.sh --run-java-tests # build + tests +# ci/build_java.sh # build only, skip tests +# ci/build_java.sh --run-java-tests # build + unit + integration tests (GPU required) +# ci/build_java.sh --unit-tests-only # build + unit tests, skip IT (arm64 CPU runner) # # Inputs (set by RAPIDS shared workflow): # RAPIDS_CUDA_VERSION @@ -23,9 +24,11 @@ set +e # Argument handling — match cuvs build_java.sh contract RUN_JAVA_TESTS="false" -if [[ "${1:-}" == "--run-java-tests" ]]; then - RUN_JAVA_TESTS="true" -fi +UNIT_TESTS_ONLY="false" +case "${1:-}" in + --run-java-tests) RUN_JAVA_TESTS="true" ;; + --unit-tests-only) UNIT_TESTS_ONLY="true" ;; +esac source rapids-configure-sccache @@ -58,18 +61,18 @@ rapids-logger "Build cuopt-java (run_tests=${RUN_JAVA_TESTS})" export CUOPT_INCLUDE="${CONDA_PREFIX}/include" export CMAKE_PREFIX_PATH="${CONDA_PREFIX}/lib" -# jextract is not on conda-forge. The CI image must provide it. -# TODO: build out a CI image with jextract preinstalled (follow-up PR). -if ! command -v jextract >/dev/null 2>&1; then - rapids-logger "ERROR: jextract not available in CI image." - rapids-logger " Add jextract for JDK 22 to the CI image." - exit 1 -fi - -# SKIP_DRIFT_CHECK=true on first build (before panama bindings are committed). -# Remove this once the panama/ files exist in the repo. +# jextract is auto-downloaded by panama-bindings/generate-bindings.sh on +# first run (cuvs pattern). No CI image change required. +# +# SKIP_DRIFT_CHECK=true in CI because the CI build uses conda's headers +# ($CONDA_PREFIX/include) while dev uses repo headers (cpp/include); +# minor formatting differences between the two sources would falsely +# trip the drift gate. The dev-workstation gate (./java/build.sh +# without this flag) is the authoritative one. if [[ "${RUN_JAVA_TESTS}" == "true" ]]; then SKIP_DRIFT_CHECK=true ./java/build.sh +elif [[ "${UNIT_TESTS_ONLY}" == "true" ]]; then + SKIP_DRIFT_CHECK=true UNIT_TESTS_ONLY=true ./java/build.sh else SKIP_DRIFT_CHECK=true SKIP_TESTS=true ./java/build.sh fi diff --git a/java/build.sh b/java/build.sh index ecafbd63bf..2257721ba6 100755 --- a/java/build.sh +++ b/java/build.sh @@ -23,6 +23,9 @@ # bindings are first committed. # SKIP_TESTS If set to 'true', runs 'mvn package' instead of # 'mvn verify'. +# UNIT_TESTS_ONLY If set to 'true', runs 'mvn test' (unit tests only, +# skips integration tests). Used by the arm64 CI job +# which has no GPU runner. set -euo pipefail @@ -102,6 +105,8 @@ echo "==> Running Maven" cd "${CURDIR}/cuopt-java" if [[ "${SKIP_TESTS:-false}" == "true" ]]; then mvn clean package -DskipTests +elif [[ "${UNIT_TESTS_ONLY:-false}" == "true" ]]; then + mvn clean test else mvn clean verify -Djava.library.path="${CUOPT_LIB_DIR}" fi diff --git a/java/cuopt-java/src/main/resources/META-INF/cuopt/supported-platforms.properties b/java/cuopt-java/src/main/resources/META-INF/cuopt/supported-platforms.properties index 04bf85bdfd..a155a80ff9 100644 --- a/java/cuopt-java/src/main/resources/META-INF/cuopt/supported-platforms.properties +++ b/java/cuopt-java/src/main/resources/META-INF/cuopt/supported-platforms.properties @@ -5,7 +5,7 @@ # Adding arm64 support is a properties-file edit, not a code change. linux-amd64=true -linux-aarch64=false +linux-aarch64=true macos-amd64=false macos-aarch64=false windows-amd64=false diff --git a/java/panama-bindings/generate-bindings.sh b/java/panama-bindings/generate-bindings.sh index 3674ea52c7..c071c41040 100755 --- a/java/panama-bindings/generate-bindings.sh +++ b/java/panama-bindings/generate-bindings.sh @@ -14,7 +14,7 @@ # the local ./jextract-22/bin/). # CUOPT_INCLUDE Path to cpp/include (defaults to ../../cpp/include). # CUDA_INCLUDE_DIR Path to CUDA include dir. Default: $CONDA_PREFIX/ -# targets/x86_64-linux/include if present, else +# targets/-linux/include if present, else # /usr/local/cuda/include. set -euo pipefail @@ -26,13 +26,25 @@ CUOPT_INCLUDE="${CUOPT_INCLUDE:-${REPODIR}/cpp/include}" OUTPUT_DIR="${REPODIR}/java/cuopt-java/src/main/java22" TARGET_PACKAGE="com.nvidia.cuopt.internal.panama" +# Architecture detection — used to select the jextract tarball and the +# CUDA toolkit include subdirectory. +HOST_ARCH="$(uname -m)" +case "${HOST_ARCH}" in + x86_64) JEXTRACT_ARCH=x64; CUDA_TARGET_DIR="targets/x86_64-linux/include" ;; + aarch64) JEXTRACT_ARCH=aarch64; CUDA_TARGET_DIR="targets/aarch64-linux/include" ;; + *) + echo "ERROR: unsupported architecture: ${HOST_ARCH}" >&2 + echo " Supported: x86_64, aarch64." >&2 + exit 1 + ;; +esac + # CUDA include detection — prefer the conda env's CUDA toolkit if active. -TARGET_DIR="targets/x86_64-linux/include" if [[ -z "${CUDA_INCLUDE_DIR:-}" ]]; then - if [[ -n "${CONDA_PREFIX:-}" ]] && [[ -d "${CONDA_PREFIX}/${TARGET_DIR}" ]]; then - CUDA_INCLUDE_DIR="${CONDA_PREFIX}/${TARGET_DIR}" - elif [[ -d "/usr/local/cuda/${TARGET_DIR}" ]]; then - CUDA_INCLUDE_DIR="/usr/local/cuda/${TARGET_DIR}" + if [[ -n "${CONDA_PREFIX:-}" ]] && [[ -d "${CONDA_PREFIX}/${CUDA_TARGET_DIR}" ]]; then + CUDA_INCLUDE_DIR="${CONDA_PREFIX}/${CUDA_TARGET_DIR}" + elif [[ -d "/usr/local/cuda/${CUDA_TARGET_DIR}" ]]; then + CUDA_INCLUDE_DIR="/usr/local/cuda/${CUDA_TARGET_DIR}" elif [[ -d "/usr/local/cuda/include" ]]; then CUDA_INCLUDE_DIR="/usr/local/cuda/include" else @@ -49,7 +61,7 @@ export PATH JEXTRACT="${JEXTRACT:-jextract}" if ! command -v "${JEXTRACT}" >/dev/null 2>&1; then - JEXTRACT_FILENAME="openjdk-22-jextract+6-47_linux-x64_bin.tar.gz" + JEXTRACT_FILENAME="openjdk-22-jextract+6-47_linux-${JEXTRACT_ARCH}_bin.tar.gz" JEXTRACT_DOWNLOAD_URL="https://download.java.net/java/early_access/jextract/22/6/${JEXTRACT_FILENAME}" echo "jextract not found. Downloading from ${JEXTRACT_DOWNLOAD_URL} ..." ( From d73133eb323410c26d29e11a5cc045442362686b Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 10:27:54 -0500 Subject: [PATCH 08/28] java/ci: run arm64 integration tests on GPU runner The rapidsai/shared-workflows matrix already includes arm64 GPU rows (linux-arm64-gpu-l4-latest-1) used by conda-python-tests, so the Java arm64 leg no longer needs to be CPU-only. Rename the job to match the amd64 sibling and switch to the full IT script. --- .github/workflows/build.yaml | 5 +++-- .github/workflows/pr.yaml | 29 ++++++++++++++--------------- ci/build_java.sh | 2 +- java/build.sh | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2202d8ae7d..55f4ba2719 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -202,8 +202,9 @@ jobs: script: "ci/build_java.sh" java-build-arm64: # Build cuopt-java JAR (arm64) for main / release-branch / tag pushes. - # CPU-only runner; integration tests stay on amd64 (no arm64 GPU - # runner wired in yet). + # Build-only (no IT) — matches the amd64 java-build sibling. PR + # integration tests run on the conda-java-build-and-tests-arm64 + # GPU job in pr.yaml. needs: [cpp-build] secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index bf92d856ea..16d009addf 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -23,7 +23,7 @@ jobs: - conda-cpp-build - conda-cpp-tests - conda-java-build-and-tests - - conda-java-build-arm64 + - conda-java-build-and-tests-arm64 - conda-python-build - conda-python-tests - docs-build @@ -405,10 +405,8 @@ jobs: script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} conda-java-build-and-tests-matrix: - # Derives the matrix from conda-cpp-build, filtered to amd64 because - # integration tests need a GPU runner and only the amd64 GPU runner - # (gpu-l4-latest-1) is currently wired up. arm64 builds + unit tests - # are handled by the conda-java-build-arm64 job below. + # Derives the matrix from conda-cpp-build, filtered to amd64. The arm64 + # sibling job conda-java-build-and-tests-arm64 handles arm64. needs: [conda-cpp-build, changed-files] if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main @@ -431,8 +429,8 @@ jobs: script: "ci/test_java.sh" file_to_upload: "java/cuopt-java/target/" artifact-name: "cuopt-java-cuda${{ needs.conda-java-build-and-tests-matrix.outputs.CUDA_VER }}" - conda-java-build-arm64-matrix: - # Matrix for the arm64 Java build, filtered to arm64 rows of + conda-java-build-and-tests-arm64-matrix: + # Matrix for the arm64 Java build+tests, filtered to arm64 rows of # conda-cpp-build. Sibling of conda-java-build-and-tests-matrix # which handles amd64. needs: [conda-cpp-build, changed-files] @@ -442,21 +440,22 @@ jobs: build_type: pull-request matrix_name: conda-cpp-build matrix_filter: 'map(select(.ARCH == "arm64"))' - conda-java-build-arm64: - # Build the JAR + run unit tests on arm64. Integration tests need a - # GPU and the arm64 GPU runner isn't wired in yet, so IT continues - # to run on amd64 only (conda-java-build-and-tests above). - needs: conda-java-build-arm64-matrix + conda-java-build-and-tests-arm64: + # Build the JAR + run unit + integration tests on arm64 GPU. Mirrors + # conda-java-build-and-tests (amd64). custom-job.yaml resolves + # runs-on to "linux-${arch}-${node_type}", so node_type is the + # suffix only (same as the amd64 sibling above). + needs: conda-java-build-and-tests-arm64-matrix if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: build_type: pull-request - node_type: "linux-arm64-cpu16" + node_type: "gpu-l4-latest-1" arch: "arm64" - script: "ci/build_java.sh --unit-tests-only" + script: "ci/test_java.sh" file_to_upload: "java/cuopt-java/target/" - artifact-name: "cuopt-java-arm64-cuda${{ needs.conda-java-build-arm64-matrix.outputs.CUDA_VER }}" + artifact-name: "cuopt-java-arm64-cuda${{ needs.conda-java-build-and-tests-arm64-matrix.outputs.CUDA_VER }}" conda-python-build: needs: [conda-cpp-build, compute-matrix-filters, changed-files] # Consumed by conda-python-tests and docs-build. diff --git a/ci/build_java.sh b/ci/build_java.sh index 98fdf4dbc5..0f20e29b15 100755 --- a/ci/build_java.sh +++ b/ci/build_java.sh @@ -7,7 +7,7 @@ # Usage: # ci/build_java.sh # build only, skip tests # ci/build_java.sh --run-java-tests # build + unit + integration tests (GPU required) -# ci/build_java.sh --unit-tests-only # build + unit tests, skip IT (arm64 CPU runner) +# ci/build_java.sh --unit-tests-only # build + unit tests, skip IT (no GPU available) # # Inputs (set by RAPIDS shared workflow): # RAPIDS_CUDA_VERSION diff --git a/java/build.sh b/java/build.sh index 2257721ba6..34813ddb41 100755 --- a/java/build.sh +++ b/java/build.sh @@ -24,8 +24,8 @@ # SKIP_TESTS If set to 'true', runs 'mvn package' instead of # 'mvn verify'. # UNIT_TESTS_ONLY If set to 'true', runs 'mvn test' (unit tests only, -# skips integration tests). Used by the arm64 CI job -# which has no GPU runner. +# skips integration tests). Useful for fast local +# feedback when no GPU is available. set -euo pipefail From ed165e2db26c087ccd4ecdc1f6938df51ca14c76 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 11:12:22 -0500 Subject: [PATCH 09/28] java: bundle libcuopt + RAPIDS deps in per-(arch,cuda) classifier JARs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a Maven `classifier-jar` profile that produces cuopt-java---cuda.jar bundling libcuopt.so, libmps_parser.so, librmm.so, and librapids_logger.so under /Linux/ inside the JAR, with manifest entry Embedded-Libraries-Cuda-Version=. Activated by `mvn -Dcuda.version=` or `CLASSIFIER_CUDA= ./java/build.sh`. The base JAR (always built) is unchanged: BYO libcuopt via System.loadLibrary. NativeLibraryLoader now inspects the JAR manifest. If the embedded marker is present, it extracts each lib to a temp file and System.load-s them in dependency order (rapids_logger → rmm → mps_parser → cuopt). Otherwise it falls back to System.loadLibrary ("cuopt"). The jextract-generated System.loadLibrary in cuopt_c_h's static initializer is rewritten by generate-bindings.sh to call NativeLibraryLoader.ensureLoaded, so both distribution modes are routed through the new loader. Not bundled (size/license/ABI risk; static-linking follow-up tracked in #1203): CUDA toolkit, gRPC, protobuf, abseil, TBB, libgomp, libstdc++. Local verification: - Base build: mvn clean verify passes (4 unit + 6 IT) - Classifier build: CLASSIFIER_CUDA=13 produces a 56 MB JAR; manual run with empty LD_LIBRARY_PATH loads cuopt via embedded mode. - Drift gate: regen is idempotent. --- java/README.md | 31 ++++ java/build.sh | 27 +++- java/cuopt-java/pom.xml | 150 ++++++++++++++++++ .../src/assembly/native-with-deps.xml | 49 ++++++ .../cuopt/internal/NativeLibraryLoader.java | 127 ++++++++++++--- .../cuopt/internal/panama/cuopt_c_h.java | 2 +- java/panama-bindings/generate-bindings.sh | 12 ++ 7 files changed, 375 insertions(+), 23 deletions(-) create mode 100644 java/cuopt-java/src/assembly/native-with-deps.xml diff --git a/java/README.md b/java/README.md index 24d5105597..0a45704007 100644 --- a/java/README.md +++ b/java/README.md @@ -85,6 +85,37 @@ cd /path/to/cuopt This regenerates panama bindings from `cpp/include/cuopt/linear_programming/cuopt_c.h`, then runs `mvn clean verify`. Output JARs land in `java/cuopt-java/target/`. +## Distribution modes + +Two JAR shapes: + +- **Base JAR** (always built) — `cuopt-java-.jar`. Contains only + Java classes. At runtime expects `libcuopt.so` to be reachable via + `java.library.path` (typical conda install: `LD_LIBRARY_PATH=$CONDA_PREFIX/lib`). + Loader path: `System.loadLibrary("cuopt")`. + +- **Classifier JAR** (opt-in) — `cuopt-java---cuda.jar`. + Bundles `libcuopt.so`, `libmps_parser.so`, `librmm.so`, `librapids_logger.so` + under `/Linux/` inside the JAR, with manifest entry + `Embedded-Libraries-Cuda-Version: `. Loader extracts to a temp + directory + `System.load`. User must still install the CUDA toolkit + matching `` (cuBLAS, cuSPARSE, cuDSS, cuBLASLt, cuDART, nvJitLink). + +To produce a classifier JAR locally: + +```bash +# Activate a RAPIDS conda env (provides librmm + librapids_logger). +conda activate cuopt +CLASSIFIER_CUDA=13 SKIP_TESTS=true ./java/build.sh +# Output: +# target/cuopt-java-.jar ← base +# target/cuopt-java--x86_64-cuda13.jar ← classifier +``` + +Excluded by policy (size + license + ABI risk; see issue #1203 for +follow-up on static-linking these into `libcuopt.so`): +CUDA toolkit, gRPC, protobuf, abseil, TBB, OpenMP, libstdc++. + ## Per-folder design notes Each directory under `java/` has its own `README.md` explaining the role diff --git a/java/build.sh b/java/build.sh index 34813ddb41..a93e35c57e 100755 --- a/java/build.sh +++ b/java/build.sh @@ -26,6 +26,11 @@ # UNIT_TESTS_ONLY If set to 'true', runs 'mvn test' (unit tests only, # skips integration tests). Useful for fast local # feedback when no GPU is available. +# CLASSIFIER_CUDA If set (e.g. '12' or '13'), additionally produces a +# classifier JAR cuopt-java---cuda.jar +# that bundles libcuopt + libmps_parser + librmm + +# librapids_logger. Requires CONDA_PREFIX to point at +# an env with librmm.so and librapids_logger.so. set -euo pipefail @@ -103,12 +108,28 @@ fi # 5. Maven build echo "==> Running Maven" cd "${CURDIR}/cuopt-java" + +MVN_ARGS=() +if [[ -n "${CLASSIFIER_CUDA:-}" ]]; then + # Activate the classifier-jar profile. The profile copies librmm.so + # and librapids_logger.so from $CONDA_PREFIX/lib, so a conda env with + # those libs must be active. + if [[ -z "${CONDA_PREFIX:-}" ]]; then + echo "ERROR: CLASSIFIER_CUDA=${CLASSIFIER_CUDA} requires CONDA_PREFIX to be set" >&2 + echo " (the classifier JAR bundles librmm.so + librapids_logger.so" >&2 + echo " from \$CONDA_PREFIX/lib). Activate a RAPIDS conda env first." >&2 + exit 1 + fi + MVN_ARGS+=("-Dcuda.version=${CLASSIFIER_CUDA}") + echo " Building classifier JAR for cuda${CLASSIFIER_CUDA} (RAPIDS libs from ${CONDA_PREFIX}/lib)" +fi + if [[ "${SKIP_TESTS:-false}" == "true" ]]; then - mvn clean package -DskipTests + mvn clean package -DskipTests "${MVN_ARGS[@]}" elif [[ "${UNIT_TESTS_ONLY:-false}" == "true" ]]; then - mvn clean test + mvn clean test "${MVN_ARGS[@]}" else - mvn clean verify -Djava.library.path="${CUOPT_LIB_DIR}" + mvn clean verify -Djava.library.path="${CUOPT_LIB_DIR}" "${MVN_ARGS[@]}" fi echo "==> cuopt-java build complete" diff --git a/java/cuopt-java/pom.xml b/java/cuopt-java/pom.xml index 895919b6c2..6ea05a3005 100644 --- a/java/cuopt-java/pom.xml +++ b/java/cuopt-java/pom.xml @@ -164,4 +164,154 @@ + + + + + + arch-amd64 + + + amd64 + + + + x86_64 + + + + + arch-aarch64 + + + aarch64 + + + + aarch64 + + + + + classifier-jar + + + cuda.version + + + + ${native.arch}-cuda${cuda.version} + ${project.basedir}/../../cpp/build + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + copy-cuopt-libs + prepare-package + + copy-resources + + + true + ${project.build.directory}/native-libs/${os.arch}/${os.name} + + + ${native.cpp.build.path} + + libcuopt.so + + + + ${native.cpp.build.path}/libmps_parser + + libmps_parser.so + + + + + + + copy-rapids-libs + prepare-package + + copy-resources + + + true + ${project.build.directory}/native-libs/${os.arch}/${os.name} + + + ${env.CONDA_PREFIX}/lib + + librmm.so + librapids_logger.so + + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.7.1 + + + src/assembly/native-with-deps.xml + + + + true + ${cuda.version} + + + + + + assemble-native + package + + single + + + + + + + + + diff --git a/java/cuopt-java/src/assembly/native-with-deps.xml b/java/cuopt-java/src/assembly/native-with-deps.xml new file mode 100644 index 0000000000..d01593318c --- /dev/null +++ b/java/cuopt-java/src/assembly/native-with-deps.xml @@ -0,0 +1,49 @@ + + + + + ${native.classifier} + + jar + + + false + + + + / + true + true + runtime + + + + + + ${project.build.directory}/native-libs + / + + **/* + + + + + diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java index 5fb723d8e1..96e4602cdb 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java @@ -7,60 +7,149 @@ import com.nvidia.cuopt.CuOptException; import java.io.IOException; import java.io.InputStream; +import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.security.CodeSource; import java.util.Locale; import java.util.Properties; +import java.util.jar.Attributes; +import java.util.jar.JarFile; +import java.util.jar.Manifest; /** - * Loads {@code libcuopt.so} (or the platform equivalent) on first use. + * Loads {@code libcuopt.so} (and its bundled RAPIDS dependencies, when + * present) on first use. + * + *

Two modes, chosen automatically by inspecting the JAR manifest: * - *

Resolution order: *

    - *
  1. If {@code libcuopt} is on {@code java.library.path}, use it - * (typical conda / system install).
  2. - *
  3. Otherwise, look for an embedded copy at - * {@code META-INF/native//libcuopt.so} inside the JAR - * (classifier-JAR install path; not yet implemented in this - * skeleton).
  4. + *
  5. Embedded mode — the JAR carries the manifest entry + * {@code Embedded-Libraries-Cuda-Version}. Native libs are + * extracted from {@code //} entries in the JAR to a + * temporary directory and {@code System.load}-ed in dependency + * order. Used by classifier JARs + * (e.g. {@code cuopt-java--x86_64-cuda13.jar}) which bundle + * {@code libcuopt.so}, {@code libmps_parser.so}, {@code librmm.so}, + * and {@code librapids_logger.so}.
  6. + *
  7. System (BYO) mode — the JAR has no + * {@code Embedded-Libraries-Cuda-Version} entry. Falls back to + * {@code System.loadLibrary("cuopt")}, requiring the user to have + * {@code libcuopt.so} on {@code java.library.path} (typical conda + * install).
  8. *
* *

The platform table at * {@code META-INF/cuopt/supported-platforms.properties} controls which - * OS+arch combinations are accepted — adding arm64 support is a - * properties-file edit, not a code change. + * OS+arch combinations are accepted. */ -final class NativeLibraryLoader { +public final class NativeLibraryLoader { private static final String PLATFORM_PROPS = "/META-INF/cuopt/supported-platforms.properties"; + private static final String EMBEDDED_MARKER = "Embedded-Libraries-Cuda-Version"; + + /** + * Libraries bundled in classifier JARs, in load order. {@code libcuopt} + * dlopen-resolves symbols from {@code librmm} and {@code librapids_logger} + * at load time, so those must be present in memory before + * {@code libcuopt} is loaded. + */ + private static final String[] EMBEDDED_LIBS = { + "rapids_logger", "rmm", "mps_parser", "cuopt", + }; + private static volatile boolean loaded = false; private NativeLibraryLoader() {} /** - * Idempotent load of {@code libcuopt}. Safe to call from multiple threads. + * Idempotent load of {@code libcuopt} and its bundled deps (if any). + * Safe to call from multiple threads. */ - static synchronized void ensureLoaded() { + public static synchronized void ensureLoaded() { if (loaded) { return; } verifyPlatformSupported(); + if (jarHasEmbeddedLibraries()) { + loadEmbedded(); + } else { + loadSystem(); + } + loaded = true; + } + + private static void loadSystem() { try { - // Prefer java.library.path (conda / system install). System.loadLibrary("cuopt"); } catch (UnsatisfiedLinkError e) { - // TODO: extract from META-INF/native//libcuopt.so once - // classifier JARs are wired up. For now, surface a clear error. throw new CuOptException( "Failed to load libcuopt. Either add the directory containing " - + "libcuopt.so (or .dll/.dylib) to java.library.path, or rely " - + "on a future classifier JAR that bundles the native library.", + + "libcuopt.so to java.library.path (typical conda install), " + + "or use a classifier JAR that bundles the native library " + + "(e.g. cuopt-java--x86_64-cuda13.jar).", e); } - loaded = true; + } + + private static void loadEmbedded() { + String os = System.getProperty("os.name", ""); + String arch = System.getProperty("os.arch", ""); + for (String name : EMBEDDED_LIBS) { + String libFile = System.mapLibraryName(name); + String resourcePath = "/" + arch + "/" + os + "/" + libFile; + try { + Path extracted = extractResource(resourcePath, libFile); + System.load(extracted.toAbsolutePath().toString()); + } catch (Throwable t) { + throw new CuOptException( + "Failed to load embedded native dependency: " + libFile + + " from resource path " + resourcePath, t); + } + } + } + + private static Path extractResource(String resourcePath, String libFile) + throws IOException { + URL url = NativeLibraryLoader.class.getResource(resourcePath); + if (url == null) { + throw new IOException( + "Embedded native library not found at " + resourcePath); + } + Path tmp = Files.createTempFile("cuopt-native-", "-" + libFile); + tmp.toFile().deleteOnExit(); + try (InputStream in = url.openStream()) { + Files.copy(in, tmp, StandardCopyOption.REPLACE_EXISTING); + } + return tmp; + } + + private static boolean jarHasEmbeddedLibraries() { + // Locate the JAR that this class was loaded from, not any other + // META-INF/MANIFEST.MF that happens to be on the classpath. + CodeSource codeSource = NativeLibraryLoader.class.getProtectionDomain().getCodeSource(); + if (codeSource == null || codeSource.getLocation() == null) { + return false; + } + String path = codeSource.getLocation().getPath(); + if (path == null || !path.endsWith(".jar")) { + // Running from exploded classes (e.g. surefire on target/classes/); + // there is no JAR manifest to inspect. + return false; + } + try (JarFile jar = new JarFile(path)) { + Manifest manifest = jar.getManifest(); + if (manifest == null) { + return false; + } + Attributes attrs = manifest.getMainAttributes(); + return attrs.getValue(EMBEDDED_MARKER) != null; + } catch (IOException e) { + return false; + } } private static void verifyPlatformSupported() { diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuopt_c_h.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuopt_c_h.java index e5dcffa9ed..1b6fcaddcd 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuopt_c_h.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/panama/cuopt_c_h.java @@ -57,7 +57,7 @@ static MemoryLayout align(MemoryLayout layout, long align) { static { - System.loadLibrary("cuopt"); + com.nvidia.cuopt.internal.NativeLibraryLoader.ensureLoaded(); } static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup() diff --git a/java/panama-bindings/generate-bindings.sh b/java/panama-bindings/generate-bindings.sh index c071c41040..7feb4b2500 100755 --- a/java/panama-bindings/generate-bindings.sh +++ b/java/panama-bindings/generate-bindings.sh @@ -89,6 +89,18 @@ jextract \ --library cuopt \ "${CURDIR}/headers.h" +# jextract emits `System.loadLibrary("cuopt")` in cuopt_c_h's static +# initializer (because we pass --use-system-load-library). That bypasses +# our NativeLibraryLoader and fails in embedded-classifier-JAR mode where +# libcuopt is bundled inside the JAR. Rewrite the call to route through +# our loader, which handles both embedded and BYO modes. +HEADER_CLASS_FILE="${PANAMA_DIR}/cuopt_c_h.java" +if [[ -f "${HEADER_CLASS_FILE}" ]]; then + sed -i \ + 's|System\.loadLibrary("cuopt");|com.nvidia.cuopt.internal.NativeLibraryLoader.ensureLoaded();|' \ + "${HEADER_CLASS_FILE}" +fi + # Normalize each generated file to end with exactly one trailing newline, # matching pre-commit's end-of-file-fixer. jextract output is inconsistent # (sometimes 0, sometimes 2 trailing newlines); without this the drift gate From a9cf64230edc84f11dddaa65919c878acf3bcf5e Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 11:56:49 -0500 Subject: [PATCH 10/28] java: wrap MIP user callbacks (cuOptSetMIP{Get,Set}SolutionCallback) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds two @FunctionalInterface types in the public API: MIPGetSolutionCallback.onSolution(double[] solution, double objectiveValue, double solutionBound) MIPSetSolutionCallback.provideSolution(double[] outSolution, double[] outObjective, double solutionBound) Registered via SolverSettings.setMIPGetSolutionCallback / setMIPSetSolutionCallback, both with null-clear semantics. Implementation in CuOptProviderImpl.registerMipCallbacks creates per-solve Arena-scoped FFM upcall stubs using the jextract-emitted allocate(Function, Arena) helpers on the cuOptMIP{Get,Set}SolutionCallback binding classes. The Get trampoline is always registered when settings is non-null and reads the user's lambda at call time (no-ops if null) — this is safe because Get registration has no solver side effects. The Set trampoline is only registered when the user has actually provided one, because registering it disables presolve per the C contract. Trampolines catch Throwable internally; exceptions never propagate across the FFM boundary. Includes MipCallbackIT with two cases: Get callback observes at least one incumbent and its primal[] is sized numVars; Set callback is invoked at least once. --- .../MIPGetSolutionCallback.java | 34 +++++ .../MIPSetSolutionCallback.java | 42 +++++++ .../linear_programming/SolverSettings.java | 50 ++++++++ .../cuopt/internal/CuOptProviderImpl.java | 77 ++++++++++++ .../linear_programming/MipCallbackIT.java | 116 ++++++++++++++++++ 5 files changed, 319 insertions(+) create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPGetSolutionCallback.java create mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPSetSolutionCallback.java create mode 100644 java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPGetSolutionCallback.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPGetSolutionCallback.java new file mode 100644 index 0000000000..b8d7a5a1d3 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPGetSolutionCallback.java @@ -0,0 +1,34 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * User-provided callback invoked by the MIP solver each time a new + * incumbent solution is found. Register via + * {@link SolverSettings#setMIPGetSolutionCallback(MIPGetSolutionCallback)}. + * + *

The arrays and scalars passed in are valid only for the duration + * of the callback. Copy any data you need to keep beyond the call. + * + *

Exceptions thrown by the callback are caught and dropped; they will + * not propagate to the native solver. + * + *

Do not call back into the solver (e.g. {@code Problem.solve()}) from + * within this callback — the solver is single-threaded and re-entry will + * deadlock or corrupt state. + * + * @see MIPSetSolutionCallback + */ +@FunctionalInterface +public interface MIPGetSolutionCallback { + + /** + * @param solution The incumbent's primal values, one per variable + * (length = number of variables in the problem). + * @param objectiveValue The incumbent's objective value. + * @param solutionBound The current dual / user bound on the optimal value. + */ + void onSolution(double[] solution, double objectiveValue, double solutionBound); +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPSetSolutionCallback.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPSetSolutionCallback.java new file mode 100644 index 0000000000..ca4f8a1b73 --- /dev/null +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPSetSolutionCallback.java @@ -0,0 +1,42 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +/** + * User-provided callback invoked by the MIP solver when it would like + * the user to inject a candidate primal solution. Register via + * {@link SolverSettings#setMIPSetSolutionCallback(MIPSetSolutionCallback)}. + * + *

Registering a set-solution callback disables presolve. + * + *

The callback must write the candidate's primal values into + * {@code outSolution} (one per variable) and its objective value into + * {@code outObjective[0]}. If the user has no candidate to inject, the + * callback should still leave the buffer in a defined state; the + * solver will use whatever is written. The arrays are valid only for + * the duration of the callback. + * + *

Exceptions thrown by the callback are caught and dropped; they will + * not propagate to the native solver. In that case, the buffer is not + * written back and the solver proceeds without an injected solution. + * + *

Do not call back into the solver (e.g. {@code Problem.solve()}) from + * within this callback — the solver is single-threaded and re-entry will + * deadlock or corrupt state. + * + * @see MIPGetSolutionCallback + */ +@FunctionalInterface +public interface MIPSetSolutionCallback { + + /** + * @param outSolution Output buffer for primal values (length = number + * of variables). Write your candidate values here. + * @param outObjective Single-element output buffer. Write the candidate's + * objective value into {@code outObjective[0]}. + * @param solutionBound The current dual / user bound on the optimal value. + */ + void provideSolution(double[] outSolution, double[] outObjective, double solutionBound); +} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java index e4e4c8218b..e02459ded9 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java @@ -37,6 +37,11 @@ public final class SolverSettings implements AutoCloseable { private long nativeHandle; // address of the native cuOptSolverSettings private boolean closed = false; + // MIP user callbacks. The Java 22 FFM impl reads these at solve time + // and binds them to per-solve Arena-scoped upcall stubs. + private MIPGetSolutionCallback mipGetCallback; + private MIPSetSolutionCallback mipSetCallback; + public SolverSettings() { this.nativeHandle = CuOptProvider.instance().createSolverSettings(); } @@ -84,6 +89,51 @@ public SolverSettings setRandomSeed(long seed) { return setIntegerParameter(CuOpt.RANDOM_SEED, seed); } + // ── MIP user callbacks ─────────────────────────────────────── + + /** + * Registers a callback to receive incumbent MIP solutions. The + * callback is invoked by the solver each time a new incumbent is + * found. Note: only meaningful for MIP solves. + * + *

Pass {@code null} to clear a previously-set callback. + * + * @see MIPGetSolutionCallback + */ + public SolverSettings setMIPGetSolutionCallback(MIPGetSolutionCallback cb) { + checkOpen(); + this.mipGetCallback = cb; + return this; + } + + /** + * Registers a callback to inject candidate MIP solutions. + * Registering this callback disables presolve. + * + *

Pass {@code null} to clear a previously-set callback. Note: once + * a non-null callback has been registered and used in a solve, + * clearing it on the same {@code SolverSettings} and reusing for + * another solve is not supported (the previous native registration + * persists). Create a fresh {@link SolverSettings} instead. + * + * @see MIPSetSolutionCallback + */ + public SolverSettings setMIPSetSolutionCallback(MIPSetSolutionCallback cb) { + checkOpen(); + this.mipSetCallback = cb; + return this; + } + + /** Returns the registered MIP get-solution callback, or {@code null}. */ + public MIPGetSolutionCallback getMIPGetSolutionCallback() { + return mipGetCallback; + } + + /** Returns the registered MIP set-solution callback, or {@code null}. */ + public MIPSetSolutionCallback getMIPSetSolutionCallback() { + return mipSetCallback; + } + // ── generic escape hatch ───────────────────────────────────── /** diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java index d88feb0c01..8403617215 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java @@ -5,6 +5,8 @@ package com.nvidia.cuopt.internal; import com.nvidia.cuopt.CuOptException; +import com.nvidia.cuopt.internal.panama.cuOptMIPGetSolutionCallback; +import com.nvidia.cuopt.internal.panama.cuOptMIPSetSolutionCallback; import com.nvidia.cuopt.internal.panama.cuopt_c_h; import com.nvidia.cuopt.linear_programming.CType; import com.nvidia.cuopt.linear_programming.Constraint; @@ -12,6 +14,8 @@ import com.nvidia.cuopt.linear_programming.ErrorStatus; import com.nvidia.cuopt.linear_programming.LinearExpr; import com.nvidia.cuopt.linear_programming.LpStats; +import com.nvidia.cuopt.linear_programming.MIPGetSolutionCallback; +import com.nvidia.cuopt.linear_programming.MIPSetSolutionCallback; import com.nvidia.cuopt.linear_programming.MilpStats; import com.nvidia.cuopt.linear_programming.Problem; import com.nvidia.cuopt.linear_programming.QuadraticExpr; @@ -345,6 +349,8 @@ private SolveResult solveAndExtract(Arena arena, ProblemBuild build, long settingsHandle = settings != null ? settings.nativeHandle() : createSolverSettings(); boolean ownSettingsHandle = (settings == null); try { + registerMipCallbacks(settings, settingsHandle, numV, arena); + MemorySegment solPtr = arena.allocate(ValueLayout.ADDRESS); int rc = cuopt_c_h.cuOptSolve( MemorySegment.ofAddress(build.problemHandle), @@ -457,6 +463,77 @@ private SolveResult solveAndExtract(Arena arena, ProblemBuild build, // ── helpers ────────────────────────────────────────────────── + /** + * Wires MIP user callbacks from {@code settings} (if any) to the native + * solver via FFM upcall stubs allocated in {@code arena}. + * + *

The Get callback is always registered when {@code settings} is non-null — + * the trampoline reads {@code settings.getMIPGetSolutionCallback()} at + * invocation time and no-ops if it's null. This is safe: registering a + * Get callback has no solver side effects. + * + *

The Set callback is registered only when the user has provided one, + * because registering it disables presolve (per the C API contract). If + * the user clears the Set callback after a previous solve registered one, + * the stale native registration persists; users should construct a new + * {@link SolverSettings} instead. + */ + private static void registerMipCallbacks( + SolverSettings settings, long settingsHandle, int numV, Arena arena) { + if (settings == null) return; + final int finalNumV = numV; + final SolverSettings finalSettings = settings; + + cuOptMIPGetSolutionCallback.Function getTrampoline = (solPtr, objPtr, boundPtr, userData) -> { + MIPGetSolutionCallback cb = finalSettings.getMIPGetSolutionCallback(); + if (cb == null) return; + try { + double[] solution = (finalNumV > 0) + ? solPtr.reinterpret(ValueLayout.JAVA_DOUBLE.byteSize() * finalNumV) + .toArray(ValueLayout.JAVA_DOUBLE) + : new double[0]; + double objVal = objPtr.reinterpret(ValueLayout.JAVA_DOUBLE.byteSize()) + .get(ValueLayout.JAVA_DOUBLE, 0); + double boundVal = boundPtr.reinterpret(ValueLayout.JAVA_DOUBLE.byteSize()) + .get(ValueLayout.JAVA_DOUBLE, 0); + cb.onSolution(solution, objVal, boundVal); + } catch (Throwable ignore) { + // Never propagate exceptions across the FFM upcall boundary. + } + }; + MemorySegment getStub = cuOptMIPGetSolutionCallback.allocate(getTrampoline, arena); + int rcGet = cuopt_c_h.cuOptSetMIPGetSolutionCallback( + MemorySegment.ofAddress(settingsHandle), getStub, MemorySegment.NULL); + checkRc(rcGet, "cuOptSetMIPGetSolutionCallback"); + + MIPSetSolutionCallback setCb = settings.getMIPSetSolutionCallback(); + if (setCb != null) { + final MIPSetSolutionCallback finalSetCb = setCb; + cuOptMIPSetSolutionCallback.Function setTrampoline = (solPtr, objPtr, boundPtr, userData) -> { + try { + double[] outSolution = new double[finalNumV]; + double[] outObjective = new double[1]; + double boundVal = boundPtr.reinterpret(ValueLayout.JAVA_DOUBLE.byteSize()) + .get(ValueLayout.JAVA_DOUBLE, 0); + finalSetCb.provideSolution(outSolution, outObjective, boundVal); + if (finalNumV > 0) { + MemorySegment.copy(outSolution, 0, + solPtr.reinterpret(ValueLayout.JAVA_DOUBLE.byteSize() * finalNumV), + ValueLayout.JAVA_DOUBLE, 0, finalNumV); + } + objPtr.reinterpret(ValueLayout.JAVA_DOUBLE.byteSize()) + .set(ValueLayout.JAVA_DOUBLE, 0, outObjective[0]); + } catch (Throwable ignore) { + // Never propagate exceptions across the FFM upcall boundary. + } + }; + MemorySegment setStub = cuOptMIPSetSolutionCallback.allocate(setTrampoline, arena); + int rcSet = cuopt_c_h.cuOptSetMIPSetSolutionCallback( + MemorySegment.ofAddress(settingsHandle), setStub, MemorySegment.NULL); + checkRc(rcSet, "cuOptSetMIPSetSolutionCallback"); + } + } + private static double[] computeSlackFromExpressions(Problem p, double[] primal) { List rows = p.constraintExpressions(); double[] slack = new double[rows.size()]; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java new file mode 100644 index 0000000000..2511372013 --- /dev/null +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java @@ -0,0 +1,116 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +package com.nvidia.cuopt.linear_programming; + +import static com.nvidia.cuopt.CuOpt.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.jupiter.api.Test; + +class MipCallbackIT { + + /** Captures one incumbent delivered by the solver. */ + private record Incumbent(double[] solution, double objective, double bound) {} + + /** + * Same 5-item knapsack as {@link MilpSolverIT}. Registers a Get callback + * and asserts that at least one incumbent was delivered, that array + * lengths match the problem dimensions, and that the final objective + * reported via {@link Problem#objectiveValue()} agrees with the last + * incumbent's objective. + */ + @Test + void get_callback_receives_incumbents() { + double[] values = {8.0, 4.0, 12.0, 3.0, 9.0}; + double[] weights = {5.0, 3.0, 8.0, 2.0, 6.0}; + double capacity = 15.0; + int n = values.length; + + List incumbents = new ArrayList<>(); + + try (var problem = new Problem("knapsack-cb"); + var settings = new SolverSettings() + .setTimeLimit(30.0) + .setRelativeMipGap(0.01)) { + + settings.setMIPGetSolutionCallback((sol, obj, bound) -> { + // Snapshot — solver may overwrite the underlying buffer after we return. + incumbents.add(new Incumbent(sol.clone(), obj, bound)); + }); + + Variable[] x = new Variable[n]; + for (int i = 0; i < n; i++) { + x[i] = problem.addVariable(0, 1, INTEGER, "x" + i); + } + problem.addConstraint(new LinearExpr().addTerms(weights, x), + LESS_EQUAL, capacity, "capacity"); + problem.setObjective(new LinearExpr().addTerms(values, x), MAXIMIZE); + + problem.solve(settings); + + assertTrue(problem.isMip()); + assertTrue(!incumbents.isEmpty(), + "Get callback should have been invoked at least once"); + + for (Incumbent inc : incumbents) { + assertEquals(n, inc.solution().length, + "Each incumbent's primal array must match numVariables"); + } + + // The final solver-reported objective should match the best incumbent's. + double bestSeen = Double.NEGATIVE_INFINITY; + for (Incumbent inc : incumbents) { + if (inc.objective() > bestSeen) bestSeen = inc.objective(); + } + assertEquals(problem.objectiveValue(), bestSeen, 1e-6, + "Final objectiveValue() should match the best incumbent observed"); + } + } + + /** + * Registers a Set callback that injects a known-feasible solution + * (all-zero, which trivially satisfies the capacity constraint). + * Confirms the callback was invoked at least once. + */ + @Test + void set_callback_is_invoked() { + double[] values = {8.0, 4.0, 12.0, 3.0, 9.0}; + double[] weights = {5.0, 3.0, 8.0, 2.0, 6.0}; + double capacity = 15.0; + int n = values.length; + + AtomicInteger setInvocations = new AtomicInteger(); + + try (var problem = new Problem("knapsack-set-cb"); + var settings = new SolverSettings() + .setTimeLimit(30.0) + .setRelativeMipGap(0.01)) { + + settings.setMIPSetSolutionCallback((outSol, outObj, bound) -> { + setInvocations.incrementAndGet(); + // All-zero is trivially feasible for this knapsack (no items chosen). + java.util.Arrays.fill(outSol, 0.0); + outObj[0] = 0.0; + }); + + Variable[] x = new Variable[n]; + for (int i = 0; i < n; i++) { + x[i] = problem.addVariable(0, 1, INTEGER, "x" + i); + } + problem.addConstraint(new LinearExpr().addTerms(weights, x), + LESS_EQUAL, capacity, "capacity"); + problem.setObjective(new LinearExpr().addTerms(values, x), MAXIMIZE); + + problem.solve(settings); + + assertTrue(setInvocations.get() >= 1, + "Set callback should have been invoked at least once, got " + setInvocations.get()); + } + } +} From 6283b6fcbdade0c6130cfc37a32d57d59d470dc3 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 13:30:28 -0500 Subject: [PATCH 11/28] [TEMP] ci: disable non-Java PR lanes while iterating on cuopt-java Gates conda-cpp-tests, conda-python-build, conda-python-tests, docs-build, all wheel-build/wheel-tests jobs, and test-self-hosted-server with `if: false`, and drops them from `pr-builder.needs`. Lanes kept on: - pre-flight: check-lean-ci, prevent-merge-with-lean-ci, compute-matrix-filters, changed-files, checks - conda-cpp-build - conda-java-build-and-tests (amd64 GPU IT) - conda-java-build-and-tests-arm64 (arm64 GPU IT) Revert this commit before merging PR #1192. --- .github/workflows/pr.yaml | 43 ++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 16d009addf..bd2f93ae88 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -13,6 +13,11 @@ concurrency: cancel-in-progress: true jobs: + # TEMPORARY: while iterating on cuopt-java (PR #1192), the non-Java CI + # lanes are gated off to speed up feedback. Each disabled job below has + # its `if:` replaced with `if: false`. **Revert this block and the + # `if: false` markers before merge.** Lanes kept on: conda-cpp-build, + # conda-java-build-and-tests (amd64 + arm64). pr-builder: needs: - check-lean-ci @@ -21,20 +26,8 @@ jobs: - changed-files - checks - conda-cpp-build - - conda-cpp-tests - conda-java-build-and-tests - conda-java-build-and-tests-arm64 - - conda-python-build - - conda-python-tests - - docs-build - - wheel-build-libcuopt - - wheel-build-cuopt - - wheel-tests-cuopt - - wheel-build-cuopt-server - - wheel-tests-cuopt-server - - wheel-build-cuopt-mps-parser - - wheel-build-cuopt-sh-client - - test-self-hosted-server secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@main if: always() @@ -392,7 +385,7 @@ jobs: conda-cpp-tests: needs: [conda-cpp-build, changed-files, compute-matrix-filters] uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. with: build_type: pull-request script: ci/test_cpp.sh @@ -459,9 +452,7 @@ jobs: conda-python-build: needs: [conda-cpp-build, compute-matrix-filters, changed-files] # Consumed by conda-python-tests and docs-build. - if: >- - fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda || - fromJSON(needs.changed-files.outputs.changed_file_groups).build_docs + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@main with: @@ -471,7 +462,7 @@ jobs: conda-python-tests: needs: [conda-python-build, changed-files, compute-matrix-filters] uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. with: run_codecov: false build_type: pull-request @@ -488,7 +479,7 @@ jobs: needs: [conda-python-build, changed-files] secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).build_docs + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. with: build_type: pull-request node_type: "gpu-l4-latest-1" @@ -500,7 +491,7 @@ jobs: wheel-build-cuopt-mps-parser: needs: [compute-matrix-filters, changed-files] # All wheel-build-* jobs feed the wheel test jobs, so they gate on the same group. - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -513,7 +504,7 @@ jobs: matrix_filter: ${{ needs.compute-matrix-filters.outputs.mps_parser_filter }} wheel-build-libcuopt: needs: [wheel-build-cuopt-mps-parser, compute-matrix-filters, changed-files] - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -525,7 +516,7 @@ jobs: script: ci/build_wheel_libcuopt.sh wheel-build-cuopt: needs: [wheel-build-cuopt-mps-parser, wheel-build-libcuopt, compute-matrix-filters, changed-files] - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -537,7 +528,7 @@ jobs: wheel-tests-cuopt: needs: [wheel-build-cuopt, wheel-build-cuopt-mps-parser, wheel-build-cuopt-sh-client, changed-files, compute-matrix-filters] uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. with: build_type: pull-request script: ci/test_wheel_cuopt.sh @@ -551,7 +542,7 @@ jobs: script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} wheel-build-cuopt-server: needs: [checks, compute-matrix-filters, changed-files] - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -564,7 +555,7 @@ jobs: matrix_filter: ${{ needs.compute-matrix-filters.outputs.cuopt_server_filter }} wheel-build-cuopt-sh-client: needs: [compute-matrix-filters, changed-files] - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -579,7 +570,7 @@ jobs: wheel-tests-cuopt-server: needs: [wheel-build-cuopt, wheel-build-cuopt-server, changed-files, compute-matrix-filters] uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. with: build_type: pull-request script: ci/test_wheel_cuopt_server.sh @@ -595,7 +586,7 @@ jobs: needs: [wheel-build-cuopt, wheel-build-cuopt-server, changed-files] secrets: inherit uses: ./.github/workflows/self_hosted_service_test.yaml - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels + if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. with: build_type: pull-request script: ci/test_self_hosted_service.sh From eb91e7ede540a9c8cae37b612727a164ea229b74 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 13:47:55 -0500 Subject: [PATCH 12/28] ci: list all jobs in pr-builder.needs (fix rapids-check-pr-job-dependencies) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shared rapidsai check `rapids-check-pr-job-dependencies` requires every top-level job in pr.yaml to be listed in `pr-builder.needs` (or in `ignored_pr_jobs`). The prior [TEMP] commit shrank that list to just the lanes we want CI signal on, which tripped the check and cascade-cancelled all downstream jobs. Restore the full list. pr-builder.yaml treats skipped jobs as success, so the `if: false` gates still effectively skip the non-Java lanes — they just have to be listed by name. Also adds the previously-missing `conda-java-build-and-tests-matrix` and `conda-java-build-and-tests-arm64-matrix` helper jobs to the list (they were never in `needs` since the Java lanes were added). Follow-up to 6283b6fc. Both this and 6283b6fc are temporary and should be reverted before merge. --- .github/workflows/pr.yaml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index bd2f93ae88..db53441796 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -14,10 +14,12 @@ concurrency: jobs: # TEMPORARY: while iterating on cuopt-java (PR #1192), the non-Java CI - # lanes are gated off to speed up feedback. Each disabled job below has - # its `if:` replaced with `if: false`. **Revert this block and the - # `if: false` markers before merge.** Lanes kept on: conda-cpp-build, - # conda-java-build-and-tests (amd64 + arm64). + # lanes are gated off with `if: false` to speed up feedback. They + # remain listed in pr-builder.needs because `rapids-check-pr-job- + # dependencies` requires every top-level job to be listed there; + # pr-builder.yaml treats skipped jobs as success, so this is safe. + # **Revert the `if: false` markers below before merge.** Lanes kept + # running: conda-cpp-build, conda-java-build-and-tests (amd64 + arm64). pr-builder: needs: - check-lean-ci @@ -26,8 +28,22 @@ jobs: - changed-files - checks - conda-cpp-build + - conda-cpp-tests + - conda-java-build-and-tests-matrix - conda-java-build-and-tests + - conda-java-build-and-tests-arm64-matrix - conda-java-build-and-tests-arm64 + - conda-python-build + - conda-python-tests + - docs-build + - wheel-build-libcuopt + - wheel-build-cuopt + - wheel-tests-cuopt + - wheel-build-cuopt-server + - wheel-tests-cuopt-server + - wheel-build-cuopt-mps-parser + - wheel-build-cuopt-sh-client + - test-self-hosted-server secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@main if: always() From 6d8fe2d23a82c5b53e64cb3dde5dc8da3a658c98 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 13:57:22 -0500 Subject: [PATCH 13/28] Revert "ci: list all jobs in pr-builder.needs" and "[TEMP] ci: disable non-Java PR lanes" Restores the original PR CI workflow: all lanes (cpp, java, python, docs, wheels, self-hosted server) run on each PR push. The two prior commits gated non-Java lanes off with `if: false` to speed up feedback during cuopt-java development; with the feature work landed, we want full CI signal again before merge. Reverts: eb91e7ed (ci: list all jobs in pr-builder.needs ...) Reverts: 6283b6fc ([TEMP] ci: disable non-Java PR lanes ...) --- .github/workflows/pr.yaml | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index db53441796..16d009addf 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -13,13 +13,6 @@ concurrency: cancel-in-progress: true jobs: - # TEMPORARY: while iterating on cuopt-java (PR #1192), the non-Java CI - # lanes are gated off with `if: false` to speed up feedback. They - # remain listed in pr-builder.needs because `rapids-check-pr-job- - # dependencies` requires every top-level job to be listed there; - # pr-builder.yaml treats skipped jobs as success, so this is safe. - # **Revert the `if: false` markers below before merge.** Lanes kept - # running: conda-cpp-build, conda-java-build-and-tests (amd64 + arm64). pr-builder: needs: - check-lean-ci @@ -29,9 +22,7 @@ jobs: - checks - conda-cpp-build - conda-cpp-tests - - conda-java-build-and-tests-matrix - conda-java-build-and-tests - - conda-java-build-and-tests-arm64-matrix - conda-java-build-and-tests-arm64 - conda-python-build - conda-python-tests @@ -401,7 +392,7 @@ jobs: conda-cpp-tests: needs: [conda-cpp-build, changed-files, compute-matrix-filters] uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@main - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp with: build_type: pull-request script: ci/test_cpp.sh @@ -468,7 +459,9 @@ jobs: conda-python-build: needs: [conda-cpp-build, compute-matrix-filters, changed-files] # Consumed by conda-python-tests and docs-build. - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: >- + fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda || + fromJSON(needs.changed-files.outputs.changed_file_groups).build_docs secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@main with: @@ -478,7 +471,7 @@ jobs: conda-python-tests: needs: [conda-python-build, changed-files, compute-matrix-filters] uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@main - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda with: run_codecov: false build_type: pull-request @@ -495,7 +488,7 @@ jobs: needs: [conda-python-build, changed-files] secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).build_docs with: build_type: pull-request node_type: "gpu-l4-latest-1" @@ -507,7 +500,7 @@ jobs: wheel-build-cuopt-mps-parser: needs: [compute-matrix-filters, changed-files] # All wheel-build-* jobs feed the wheel test jobs, so they gate on the same group. - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -520,7 +513,7 @@ jobs: matrix_filter: ${{ needs.compute-matrix-filters.outputs.mps_parser_filter }} wheel-build-libcuopt: needs: [wheel-build-cuopt-mps-parser, compute-matrix-filters, changed-files] - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -532,7 +525,7 @@ jobs: script: ci/build_wheel_libcuopt.sh wheel-build-cuopt: needs: [wheel-build-cuopt-mps-parser, wheel-build-libcuopt, compute-matrix-filters, changed-files] - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -544,7 +537,7 @@ jobs: wheel-tests-cuopt: needs: [wheel-build-cuopt, wheel-build-cuopt-mps-parser, wheel-build-cuopt-sh-client, changed-files, compute-matrix-filters] uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@main - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels with: build_type: pull-request script: ci/test_wheel_cuopt.sh @@ -558,7 +551,7 @@ jobs: script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} wheel-build-cuopt-server: needs: [checks, compute-matrix-filters, changed-files] - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -571,7 +564,7 @@ jobs: matrix_filter: ${{ needs.compute-matrix-filters.outputs.cuopt_server_filter }} wheel-build-cuopt-sh-client: needs: [compute-matrix-filters, changed-files] - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main with: @@ -586,7 +579,7 @@ jobs: wheel-tests-cuopt-server: needs: [wheel-build-cuopt, wheel-build-cuopt-server, changed-files, compute-matrix-filters] uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@main - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels with: build_type: pull-request script: ci/test_wheel_cuopt_server.sh @@ -602,7 +595,7 @@ jobs: needs: [wheel-build-cuopt, wheel-build-cuopt-server, changed-files] secrets: inherit uses: ./.github/workflows/self_hosted_service_test.yaml - if: false # TEMP: disabled while iterating on cuopt-java (PR #1192). Revert before merge. + if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels with: build_type: pull-request script: ci/test_self_hosted_service.sh From 2e3d2fed8b395e86b6509390df283f71781d59df Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 13:57:56 -0500 Subject: [PATCH 14/28] ci: list java build-and-tests matrix jobs in pr-builder.needs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rapids-check-pr-job-dependencies (run as part of the shared `checks` workflow) requires every top-level job in pr.yaml to appear in `pr-builder.needs` (or in `ignored_pr_jobs`). The two Java matrix- compute helper jobs were missing from `pr-builder.needs` ever since they were introduced — pre-existing gap, surfaced now that CI is running on this PR. pr-builder treats skipped or success as passing, so adding these intermediate compute jobs to the list has no behavioral effect on green PRs. --- .github/workflows/pr.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 16d009addf..9cd416aa41 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -22,7 +22,9 @@ jobs: - checks - conda-cpp-build - conda-cpp-tests + - conda-java-build-and-tests-matrix - conda-java-build-and-tests + - conda-java-build-and-tests-arm64-matrix - conda-java-build-and-tests-arm64 - conda-python-build - conda-python-tests From e5cbab81a3af3d3104cbef8bded7b39fb8db0121 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 15:11:45 -0500 Subject: [PATCH 15/28] java/ci: pass major.minor CUDA version to dep-file-generator The conda env build was failing with: ValueError: No matching matrix found in 'cuda_version' for: {'cuda': '13', 'arch': 'x86_64'} dependencies.yaml's `cuda_version` matrix is keyed on major.minor (e.g. "13.0", "13.1"); we were stripping RAPIDS_CUDA_VERSION to just the major ("13") via `%%.*` (longest prefix-match-from-end). The result didn't match any matrix row, the dep-file-generator errored, the conda env was created empty, and the subsequent build failed with "java not found in PATH". Switch to `%.*` (shortest prefix-match-from-end) to keep "13.0" from "13.0.2", matching what ci/test_python.sh:23 does for the same env variable. --- ci/build_java.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_java.sh b/ci/build_java.sh index 0f20e29b15..516f0740bc 100755 --- a/ci/build_java.sh +++ b/ci/build_java.sh @@ -45,7 +45,7 @@ rapids-logger "Generate Java conda environment" rapids-dependency-file-generator \ --output conda \ --file-key test_java \ - --matrix "cuda=${RAPIDS_CUDA_VERSION%%.*};arch=$(arch)" \ + --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch)" \ --prepend-channel "${CPP_CHANNEL}" \ | tee env.yaml From 182d518b1409133fa4f81e7e0ba44793af49bf5b Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 15:15:47 -0500 Subject: [PATCH 16/28] [TEMP] ci: prune non-Java PR lanes while iterating on cuopt-java Removes the following PR-only jobs entirely (not just `if: false`-d): - conda-cpp-tests - conda-python-build - conda-python-tests - docs-build - wheel-build-cuopt-mps-parser - wheel-build-libcuopt - wheel-build-cuopt - wheel-tests-cuopt - wheel-build-cuopt-server - wheel-build-cuopt-sh-client - wheel-tests-cuopt-server - test-self-hosted-server And drops their references from `pr-builder.needs`. Kept on: - pre-flight (check-lean-ci, prevent-merge-with-lean-ci, compute-matrix-filters, changed-files, checks) - conda-cpp-build - conda-java-build-and-tests* (amd64 GPU IT) - conda-java-build-and-tests-arm64* (arm64 GPU IT) Earlier `if: false` approach broke because the shared `rapids-check-pr-job-dependencies` check requires every job to be listed in pr-builder.needs. Removing the jobs entirely sidesteps that. **Revert this commit before merge.** --- .github/workflows/pr.yaml | 246 +------------------------------------- 1 file changed, 4 insertions(+), 242 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 282aefec55..ddb2804779 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -15,6 +15,10 @@ concurrency: permissions: {} jobs: + # TEMPORARY: while iterating on cuopt-java (PR #1192), non-Java CI + # lanes (conda-cpp-tests, conda-python-*, docs-build, all wheel-*, + # test-self-hosted-server) are removed from this workflow. **Restore + # them before merge.** pr-builder: needs: - check-lean-ci @@ -23,22 +27,10 @@ jobs: - changed-files - checks - conda-cpp-build - - conda-cpp-tests - conda-java-build-and-tests-matrix - conda-java-build-and-tests - conda-java-build-and-tests-arm64-matrix - conda-java-build-and-tests-arm64 - - conda-python-build - - conda-python-tests - - docs-build - - wheel-build-libcuopt - - wheel-build-cuopt - - wheel-tests-cuopt - - wheel-build-cuopt-server - - wheel-tests-cuopt-server - - wheel-build-cuopt-mps-parser - - wheel-build-cuopt-sh-client - - test-self-hosted-server permissions: contents: read uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@main @@ -416,27 +408,6 @@ jobs: build_type: pull-request script: ci/build_cpp.sh matrix_filter: ${{ needs.compute-matrix-filters.outputs.conda_lean_filter }} - conda-cpp-tests: - needs: [conda-cpp-build, changed-files, compute-matrix-filters] - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp - with: - build_type: pull-request - script: ci/test_cpp.sh - matrix_filter: ${{ needs.compute-matrix-filters.outputs.conda_test_filter }} - secrets: - script-env-secret-1-key: CUOPT_S3_URI - script-env-secret-1-value: ${{ secrets.CUOPT_S3_URI }} - script-env-secret-2-key: CUOPT_AWS_ACCESS_KEY_ID - script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }} - script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY - script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} conda-java-build-and-tests-matrix: # Derives the matrix from conda-cpp-build, filtered to amd64. The arm64 # sibling job conda-java-build-and-tests-arm64 handles arm64. @@ -489,212 +460,3 @@ jobs: script: "ci/test_java.sh" file_to_upload: "java/cuopt-java/target/" artifact-name: "cuopt-java-arm64-cuda${{ needs.conda-java-build-and-tests-arm64-matrix.outputs.CUDA_VER }}" - conda-python-build: - needs: [conda-cpp-build, compute-matrix-filters, changed-files] - # Consumed by conda-python-tests and docs-build. - if: >- - fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda || - fromJSON(needs.changed-files.outputs.changed_file_groups).build_docs - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@main - with: - build_type: pull-request - script: ci/build_python.sh - matrix_filter: ${{ needs.compute-matrix-filters.outputs.conda_test_filter }} - conda-python-tests: - needs: [conda-python-build, changed-files, compute-matrix-filters] - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_conda - with: - run_codecov: false - build_type: pull-request - script: ci/test_python.sh - matrix_filter: ${{ needs.compute-matrix-filters.outputs.conda_test_filter }} - secrets: - script-env-secret-1-key: CUOPT_S3_URI - script-env-secret-1-value: ${{ secrets.CUOPT_S3_URI }} - script-env-secret-2-key: CUOPT_AWS_ACCESS_KEY_ID - script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }} - script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY - script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} - docs-build: - needs: [conda-python-build, changed-files] - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).build_docs - with: - build_type: pull-request - node_type: "gpu-l4-latest-1" - arch: "amd64" - file_to_upload: "docs/cuopt/build/html/" - artifact-name: "cuopt_docs" - container_image: "rapidsai/ci-conda:26.06-latest" - script: "ci/build_docs.sh" - wheel-build-cuopt-mps-parser: - needs: [compute-matrix-filters, changed-files] - # All wheel-build-* jobs feed the wheel test jobs, so they gate on the same group. - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main - with: - build_type: pull-request - script: ci/build_wheel_cuopt_mps_parser.sh - package-name: cuopt_mps_parser - package-type: python - append-cuda-suffix: false - # need 1 build per Python version and arch (but CUDA version doesn't matter so choose the latest) - matrix_filter: ${{ needs.compute-matrix-filters.outputs.mps_parser_filter }} - wheel-build-libcuopt: - needs: [wheel-build-cuopt-mps-parser, compute-matrix-filters, changed-files] - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main - with: - # build for every combination of arch and CUDA version, but only for the latest Python - matrix_filter: ${{ needs.compute-matrix-filters.outputs.libcuopt_filter }} - package-type: cpp - package-name: libcuopt - build_type: pull-request - script: ci/build_wheel_libcuopt.sh - wheel-build-cuopt: - needs: [wheel-build-cuopt-mps-parser, wheel-build-libcuopt, compute-matrix-filters, changed-files] - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main - with: - build_type: pull-request - script: ci/build_wheel_cuopt.sh - package-name: cuopt - package-type: python - matrix_filter: ${{ needs.compute-matrix-filters.outputs.wheel_lean_filter }} - wheel-tests-cuopt: - needs: [wheel-build-cuopt, wheel-build-cuopt-mps-parser, wheel-build-cuopt-sh-client, changed-files, compute-matrix-filters] - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels - with: - build_type: pull-request - script: ci/test_wheel_cuopt.sh - matrix_filter: ${{ needs.compute-matrix-filters.outputs.wheel_lean_filter }} - secrets: - script-env-secret-1-key: CUOPT_S3_URI - script-env-secret-1-value: ${{ secrets.CUOPT_S3_URI }} - script-env-secret-2-key: CUOPT_AWS_ACCESS_KEY_ID - script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }} - script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY - script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} - wheel-build-cuopt-server: - needs: [checks, compute-matrix-filters, changed-files] - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main - with: - build_type: pull-request - script: ci/build_wheel_cuopt_server.sh - package-name: cuopt_server - package-type: python - pure-wheel: true - # Only need 1 package per CUDA major version. This selects "ARCH=amd64 + the latest supported Python, 1 job per major CUDA version". - matrix_filter: ${{ needs.compute-matrix-filters.outputs.cuopt_server_filter }} - wheel-build-cuopt-sh-client: - needs: [compute-matrix-filters, changed-files] - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@main - with: - build_type: pull-request - script: ci/build_wheel_cuopt_sh_client.sh - package-name: cuopt_sh_client - package-type: python - append-cuda-suffix: false - pure-wheel: true - # only need 1 build (noarch package): this selects amd64, oldest-supported Python, latest-supported CUDA - matrix_filter: ${{ needs.compute-matrix-filters.outputs.cuopt_sh_client_filter }} - wheel-tests-cuopt-server: - needs: [wheel-build-cuopt, wheel-build-cuopt-server, changed-files, compute-matrix-filters] - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@main - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels - with: - build_type: pull-request - script: ci/test_wheel_cuopt_server.sh - matrix_filter: ${{ needs.compute-matrix-filters.outputs.wheel_lean_filter }} - secrets: - script-env-secret-1-key: CUOPT_S3_URI - script-env-secret-1-value: ${{ secrets.CUOPT_S3_URI }} - script-env-secret-2-key: CUOPT_AWS_ACCESS_KEY_ID - script-env-secret-2-value: ${{ secrets.CUOPT_AWS_ACCESS_KEY_ID }} - script-env-secret-3-key: CUOPT_AWS_SECRET_ACCESS_KEY - script-env-secret-3-value: ${{ secrets.CUOPT_AWS_SECRET_ACCESS_KEY }} - test-self-hosted-server: - needs: [wheel-build-cuopt, wheel-build-cuopt-server, changed-files] - permissions: - actions: read - contents: read - id-token: write - packages: read - pull-requests: read - secrets: inherit # zizmor: ignore[secrets-inherit] - uses: ./.github/workflows/self_hosted_service_test.yaml - if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_wheels - with: - build_type: pull-request - script: ci/test_self_hosted_service.sh From 0aff867949d764d1fbbf97961c74e28ac4d3567d Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 15:16:51 -0500 Subject: [PATCH 17/28] ci: silence zizmor secrets-inherit on Java jobs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Java jobs were added before zizmor was wired into pre-commit (upstream PR #1181). They use `secrets: inherit` for the same reason all other reusable-workflow consumers in this repo do — the called workflow needs the script-env secrets to upload artifacts. Add the suppression comment used by the rest of the file. --- .github/workflows/pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index ddb2804779..d3c712f01b 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -424,7 +424,7 @@ jobs: # artifact passing. cuvs Issue #868 tracks the same split. needs: conda-java-build-and-tests-matrix if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java - secrets: inherit + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: build_type: pull-request @@ -451,7 +451,7 @@ jobs: # suffix only (same as the amd64 sibling above). needs: conda-java-build-and-tests-arm64-matrix if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java - secrets: inherit + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: build_type: pull-request From 8259ac577f9db4389b9e643e7f19ad21f70e7fd6 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 15:22:28 -0500 Subject: [PATCH 18/28] ci: add per-job permissions blocks to the Java jobs Pre-existing gap on the Java jobs from my earlier commits, surfaced by the upstream `permissions: {}` top-level default added in PR #1181: with no top-level permissions and no per-job block, each Java reusable-workflow call inherited the deny-all default and GitHub Actions rejected the workflow with is requesting 'actions: read, contents: read, ...', but is only allowed 'actions: none, contents: none, ...' Mirror the permissions block that `conda-cpp-build` uses (actions, contents, packages, pull-requests, id-token) on the two Java build+test jobs and the two compute-matrix helpers. --- .github/workflows/pr.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index d3c712f01b..1a1c8f7e41 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -413,6 +413,12 @@ jobs: # sibling job conda-java-build-and-tests-arm64 handles arm64. needs: [conda-cpp-build, changed-files] if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main with: build_type: pull-request @@ -424,6 +430,12 @@ jobs: # artifact passing. cuvs Issue #868 tracks the same split. needs: conda-java-build-and-tests-matrix if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: @@ -439,6 +451,12 @@ jobs: # which handles amd64. needs: [conda-cpp-build, changed-files] if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read uses: rapidsai/shared-workflows/.github/workflows/compute-matrix.yaml@main with: build_type: pull-request @@ -451,6 +469,12 @@ jobs: # suffix only (same as the amd64 sibling above). needs: conda-java-build-and-tests-arm64-matrix if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_java + permissions: + actions: read + contents: read + id-token: write + packages: read + pull-requests: read secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: From 968944246fff60a9eb30b4bade609b895543ef8b Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 15:29:45 -0500 Subject: [PATCH 19/28] ci: silence zizmor secrets-inherit on Java build.yaml jobs Same pattern as 0aff8679 (which fixed it on pr.yaml). The two java-build jobs in build.yaml were also added before zizmor was wired into pre-commit (upstream PR #1181). Add the suppression comment used by every other reusable-workflow consumer in this file. --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 23095fcd0f..1f9fa54f68 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -271,7 +271,7 @@ jobs: # Build cuopt-java JAR (amd64) for main / release-branch / tag pushes. # Integration tests are not run here — they live in test.yaml. needs: [cpp-build] - secrets: inherit + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: build_type: ${{ inputs.build_type || 'branch' }} @@ -290,7 +290,7 @@ jobs: # integration tests run on the conda-java-build-and-tests-arm64 # GPU job in pr.yaml. needs: [cpp-build] - secrets: inherit + secrets: inherit # zizmor: ignore[secrets-inherit] uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@main with: build_type: ${{ inputs.build_type || 'branch' }} From 54a8b9c54040d2beee6b961ee011cb9390e44932 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 12 May 2026 17:38:44 -0500 Subject: [PATCH 20/28] java/ci: skip panama bindings regen in CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI was failing on the jextract regen step with: ERROR: Could not locate a CUDA include directory. generate-bindings.sh needs CUDA dev headers to run jextract against cuopt_c.h's transitive #includes. The conda env used in CI for the Java jobs (`test_java` group in dependencies.yaml) only installs openjdk + maven + libcuopt — no CUDA dev headers. CI was already skipping the drift check (SKIP_DRIFT_CHECK=true), so the regen was wasted work and just a fragile failure point. Add a SKIP_BINDINGS_REGEN env var and set it in ci/build_java.sh — the committed bindings are trusted, with the dev-workstation drift gate (./java/build.sh without flags) as the authoritative check. Verified locally: with SKIP_BINDINGS_REGEN=true the regen step is skipped and the build still succeeds. --- ci/build_java.sh | 12 +++++++++--- java/build.sh | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ci/build_java.sh b/ci/build_java.sh index 516f0740bc..7ac12a9299 100755 --- a/ci/build_java.sh +++ b/ci/build_java.sh @@ -69,12 +69,18 @@ export CMAKE_PREFIX_PATH="${CONDA_PREFIX}/lib" # minor formatting differences between the two sources would falsely # trip the drift gate. The dev-workstation gate (./java/build.sh # without this flag) is the authoritative one. +# SKIP_BINDINGS_REGEN=true because the conda env used in CI does not +# install CUDA development headers (only libcuopt + openjdk + maven), +# so jextract cannot regenerate the panama bindings from cuopt_c.h. +# The committed bindings are trusted; the dev-workstation drift gate +# in ./java/build.sh (run without SKIP_DRIFT_CHECK locally) is the +# authoritative check that they stay in sync. if [[ "${RUN_JAVA_TESTS}" == "true" ]]; then - SKIP_DRIFT_CHECK=true ./java/build.sh + SKIP_DRIFT_CHECK=true SKIP_BINDINGS_REGEN=true ./java/build.sh elif [[ "${UNIT_TESTS_ONLY}" == "true" ]]; then - SKIP_DRIFT_CHECK=true UNIT_TESTS_ONLY=true ./java/build.sh + SKIP_DRIFT_CHECK=true SKIP_BINDINGS_REGEN=true UNIT_TESTS_ONLY=true ./java/build.sh else - SKIP_DRIFT_CHECK=true SKIP_TESTS=true ./java/build.sh + SKIP_DRIFT_CHECK=true SKIP_BINDINGS_REGEN=true SKIP_TESTS=true ./java/build.sh fi rapids-logger "Show sccache stats" diff --git a/java/build.sh b/java/build.sh index a93e35c57e..acfdd846ae 100755 --- a/java/build.sh +++ b/java/build.sh @@ -21,6 +21,12 @@ # SKIP_DRIFT_CHECK If set to 'true', skips the panama drift gate. # Useful in initial-bootstrap commits before the # bindings are first committed. +# SKIP_BINDINGS_REGEN +# If set to 'true', skips the panama bindings +# regeneration step (jextract invocation). Useful +# in CI where the committed bindings are trusted +# and the build env lacks CUDA headers needed by +# jextract. # SKIP_TESTS If set to 'true', runs 'mvn package' instead of # 'mvn verify'. # UNIT_TESTS_ONLY If set to 'true', runs 'mvn test' (unit tests only, @@ -87,9 +93,13 @@ if [[ ! -f "${CUOPT_LIB_DIR}/libcuopt.so" ]]; then fi export LD_LIBRARY_PATH="${CUOPT_LIB_DIR}:${LD_LIBRARY_PATH:-}" -# 3. Regenerate panama bindings -echo "==> Regenerating panama bindings" -"${CURDIR}/panama-bindings/generate-bindings.sh" +# 3. Regenerate panama bindings (skipped in CI; bindings are committed +# and the dev-workstation gate is authoritative, see SKIP_BINDINGS_REGEN +# in the env block above). +if [[ "${SKIP_BINDINGS_REGEN:-false}" != "true" ]]; then + echo "==> Regenerating panama bindings" + "${CURDIR}/panama-bindings/generate-bindings.sh" +fi # 4. Drift gate if [[ "${SKIP_DRIFT_CHECK:-false}" != "true" ]]; then From f27ed56c109cf99263b1f4f2ca13ea126fbd6114 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 13 May 2026 10:28:33 -0500 Subject: [PATCH 21/28] ci/java: add CUDA runtime libs to test_java conda env The Java CI conda env was missing libcusparse.so.12 (and friends) at load time: java.lang.UnsatisfiedLinkError: /opt/conda/envs/java/lib/libcuopt.so: libcusparse.so.12: cannot open shared object file: No such file or directory libcuopt's conda recipe lists libcublas / libcudss-dev / libcusparse-dev only under `host:` (build-time) and explicitly `ignore_run_exports`-es them; CUDA runtime libs are not declared as `run:` deps. Python tests work around this by pulling them in transitively via cudf / cupy / cuda-python. The Java env has no such chain, so we have to declare them ourselves. Adds libcublas, libcudart, libcudss, libcusparse, libnvjitlink to the `java` dep group in dependencies.yaml. Mirrors the ldd of libcuopt.so (libcublasLt rides along with libcublas). A cleaner fix would be to add these to libcuopt's `run:` deps, but that's a broader change with cross-team coordination. --- conda/environments/all_cuda-129_arch-aarch64.yaml | 5 +++++ conda/environments/all_cuda-129_arch-x86_64.yaml | 5 +++++ conda/environments/all_cuda-131_arch-aarch64.yaml | 5 +++++ conda/environments/all_cuda-131_arch-x86_64.yaml | 5 +++++ dependencies.yaml | 12 ++++++++++++ 5 files changed, 32 insertions(+) diff --git a/conda/environments/all_cuda-129_arch-aarch64.yaml b/conda/environments/all_cuda-129_arch-aarch64.yaml index 0b33f90b9b..0c769ed4a5 100644 --- a/conda/environments/all_cuda-129_arch-aarch64.yaml +++ b/conda/environments/all_cuda-129_arch-aarch64.yaml @@ -30,11 +30,16 @@ dependencies: - jsonref==1.1.0 - libabseil - libboost-devel +- libcublas +- libcudart +- libcudss - libcudss-dev >=0.7 - libcurand-dev - libcusolver-dev +- libcusparse - libcusparse-dev - libgrpc >=1.78.0,<1.80.0a0 +- libnvjitlink - libprotobuf - libraft-headers==26.6.*,>=0.0.0a0 - librmm==26.6.*,>=0.0.0a0 diff --git a/conda/environments/all_cuda-129_arch-x86_64.yaml b/conda/environments/all_cuda-129_arch-x86_64.yaml index 26bc3d66fd..a7595c7d17 100644 --- a/conda/environments/all_cuda-129_arch-x86_64.yaml +++ b/conda/environments/all_cuda-129_arch-x86_64.yaml @@ -30,11 +30,16 @@ dependencies: - jsonref==1.1.0 - libabseil - libboost-devel +- libcublas +- libcudart +- libcudss - libcudss-dev >=0.7 - libcurand-dev - libcusolver-dev +- libcusparse - libcusparse-dev - libgrpc >=1.78.0,<1.80.0a0 +- libnvjitlink - libprotobuf - libraft-headers==26.6.*,>=0.0.0a0 - librmm==26.6.*,>=0.0.0a0 diff --git a/conda/environments/all_cuda-131_arch-aarch64.yaml b/conda/environments/all_cuda-131_arch-aarch64.yaml index 1f7bd3f01e..9a711fab3b 100644 --- a/conda/environments/all_cuda-131_arch-aarch64.yaml +++ b/conda/environments/all_cuda-131_arch-aarch64.yaml @@ -30,11 +30,16 @@ dependencies: - jsonref==1.1.0 - libabseil - libboost-devel +- libcublas +- libcudart +- libcudss - libcudss-dev >=0.7 - libcurand-dev - libcusolver-dev +- libcusparse - libcusparse-dev - libgrpc >=1.78.0,<1.80.0a0 +- libnvjitlink - libprotobuf - libraft-headers==26.6.*,>=0.0.0a0 - librmm==26.6.*,>=0.0.0a0 diff --git a/conda/environments/all_cuda-131_arch-x86_64.yaml b/conda/environments/all_cuda-131_arch-x86_64.yaml index 28fec0fa58..76eb801532 100644 --- a/conda/environments/all_cuda-131_arch-x86_64.yaml +++ b/conda/environments/all_cuda-131_arch-x86_64.yaml @@ -30,11 +30,16 @@ dependencies: - jsonref==1.1.0 - libabseil - libboost-devel +- libcublas +- libcudart +- libcudss - libcudss-dev >=0.7 - libcurand-dev - libcusolver-dev +- libcusparse - libcusparse-dev - libgrpc >=1.78.0,<1.80.0a0 +- libnvjitlink - libprotobuf - libraft-headers==26.6.*,>=0.0.0a0 - librmm==26.6.*,>=0.0.0a0 diff --git a/dependencies.yaml b/dependencies.yaml index 759d1dbfa7..424b60ec55 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -333,6 +333,18 @@ dependencies: # generate-bindings.sh auto-downloads it (cuvs pattern). For # CI to be hermetic, consider preinstalling jextract in the # ci-conda image; for now, the build pulls it on first run. + # + # libcuopt's conda recipe omits CUDA runtime libs from its + # `run:` deps (host-only). Python tests pick them up + # transitively via cudf/cupy/cuda-python; Java tests have no + # such chain, so we declare them explicitly here. Matches the + # ldd of libcuopt.so: libcublas, libcusparse, libcudart, + # libcudss, libnvjitlink (libcublasLt ships with libcublas). + - libcublas + - libcudart + - libcudss + - libcusparse + - libnvjitlink test_cpp_cuopt: common: - output_types: [conda] From 03ea02e27e2ebd81dcf912b5f3f3895cce891f4e Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 13 May 2026 13:30:48 -0500 Subject: [PATCH 22/28] =?UTF-8?q?ci/java:=20fix=20CUDA=20runtime=20package?= =?UTF-8?q?=20name=20(libcudart=20=E2=86=92=20cuda-cudart)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous attempt added `libcudart` to the `java` dep group, but the mamba solver rejected it: libcudart =* * does not exist (perhaps a typo or a missing channel). The conda-forge feedstock for the CUDA runtime is named `cuda-cudart` (checked against https://api.anaconda.org/package/conda-forge/...). `libcudart` is not a published package name on any of the channels the test_java env uses (rapidsai, rapidsai-nightly, conda-forge). The other four (libcublas, libcudss, libcusparse, libnvjitlink) do exist under those names — no change needed. --- conda/environments/all_cuda-129_arch-aarch64.yaml | 2 +- conda/environments/all_cuda-129_arch-x86_64.yaml | 2 +- conda/environments/all_cuda-131_arch-aarch64.yaml | 2 +- conda/environments/all_cuda-131_arch-x86_64.yaml | 2 +- dependencies.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conda/environments/all_cuda-129_arch-aarch64.yaml b/conda/environments/all_cuda-129_arch-aarch64.yaml index 0c769ed4a5..2434b51dab 100644 --- a/conda/environments/all_cuda-129_arch-aarch64.yaml +++ b/conda/environments/all_cuda-129_arch-aarch64.yaml @@ -14,6 +14,7 @@ dependencies: - clang==20.1.8 - cmake>=3.30.4 - cpp-argparse +- cuda-cudart - cuda-nvcc - cuda-nvtx-dev - cuda-python>=12.9.2,<13.0 @@ -31,7 +32,6 @@ dependencies: - libabseil - libboost-devel - libcublas -- libcudart - libcudss - libcudss-dev >=0.7 - libcurand-dev diff --git a/conda/environments/all_cuda-129_arch-x86_64.yaml b/conda/environments/all_cuda-129_arch-x86_64.yaml index a7595c7d17..8dd8c057af 100644 --- a/conda/environments/all_cuda-129_arch-x86_64.yaml +++ b/conda/environments/all_cuda-129_arch-x86_64.yaml @@ -14,6 +14,7 @@ dependencies: - clang==20.1.8 - cmake>=3.30.4 - cpp-argparse +- cuda-cudart - cuda-nvcc - cuda-nvtx-dev - cuda-python>=12.9.2,<13.0 @@ -31,7 +32,6 @@ dependencies: - libabseil - libboost-devel - libcublas -- libcudart - libcudss - libcudss-dev >=0.7 - libcurand-dev diff --git a/conda/environments/all_cuda-131_arch-aarch64.yaml b/conda/environments/all_cuda-131_arch-aarch64.yaml index 9a711fab3b..d07640027a 100644 --- a/conda/environments/all_cuda-131_arch-aarch64.yaml +++ b/conda/environments/all_cuda-131_arch-aarch64.yaml @@ -14,6 +14,7 @@ dependencies: - clang==20.1.8 - cmake>=3.30.4 - cpp-argparse +- cuda-cudart - cuda-nvcc - cuda-nvtx-dev - cuda-python>=13.0.1,<14.0 @@ -31,7 +32,6 @@ dependencies: - libabseil - libboost-devel - libcublas -- libcudart - libcudss - libcudss-dev >=0.7 - libcurand-dev diff --git a/conda/environments/all_cuda-131_arch-x86_64.yaml b/conda/environments/all_cuda-131_arch-x86_64.yaml index 76eb801532..700ca2a513 100644 --- a/conda/environments/all_cuda-131_arch-x86_64.yaml +++ b/conda/environments/all_cuda-131_arch-x86_64.yaml @@ -14,6 +14,7 @@ dependencies: - clang==20.1.8 - cmake>=3.30.4 - cpp-argparse +- cuda-cudart - cuda-nvcc - cuda-nvtx-dev - cuda-python>=13.0.1,<14.0 @@ -31,7 +32,6 @@ dependencies: - libabseil - libboost-devel - libcublas -- libcudart - libcudss - libcudss-dev >=0.7 - libcurand-dev diff --git a/dependencies.yaml b/dependencies.yaml index 424b60ec55..f94f469dc4 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -340,8 +340,8 @@ dependencies: # such chain, so we declare them explicitly here. Matches the # ldd of libcuopt.so: libcublas, libcusparse, libcudart, # libcudss, libnvjitlink (libcublasLt ships with libcublas). + - cuda-cudart - libcublas - - libcudart - libcudss - libcusparse - libnvjitlink From c609cb8db72d2de3093f06546b420d194199d503 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 13 May 2026 16:03:28 -0500 Subject: [PATCH 23/28] java: consistent naming for acronyms (MIP/QP/CSR/IP) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per review feedback (chris-maes): Problem.isMip() → isMIP() Problem.isQp() → isQP() MilpStats → MIPStats (record class rename) MilpStats.java → MIPStats.java (file rename) Problem.milpStats() → mipStats() (method rename; field too) CsrBuilder → CSRBuilder (internal class rename) CsrBuilder.java → CSRBuilder.java (file rename) CsrBuilder.Csr → CSRBuilder.CSR (inner record + method names) ProblemCategory.IP removed (folded into MIP) Java is okay with either PascalCase (Csr) or all-caps (CSR) for acronyms in identifiers; this PR moves to all-caps consistently. --- .../cuopt/linear_programming/DataModel.java | 8 +++---- .../{MilpStats.java => MIPStats.java} | 4 ++-- .../cuopt/linear_programming/Problem.java | 22 ++++++++----------- .../linear_programming/ProblemCategory.java | 4 +--- .../com/nvidia/cuopt/spi/SolveResult.java | 4 ++-- .../{CsrBuilder.java => CSRBuilder.java} | 16 +++++++------- .../cuopt/internal/CuOptProviderImpl.java | 14 ++++++------ .../linear_programming/MilpSolverIT.java | 4 ++-- .../linear_programming/MipCallbackIT.java | 2 +- 9 files changed, 36 insertions(+), 42 deletions(-) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/{MilpStats.java => MIPStats.java} (88%) rename java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/{CsrBuilder.java => CSRBuilder.java} (93%) diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java index 5f917c81ab..e2afff8e4d 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java @@ -73,7 +73,7 @@ public final class DataModel implements AutoCloseable { private double solveTime; private SolverMethod solvedBy; private LpStats lpStats; - private MilpStats milpStats; + private MIPStats mipStats; private boolean closed = false; @@ -228,9 +228,9 @@ public LpStats lpStats() { return lpStats; } - public Optional milpStats() { + public Optional mipStats() { checkSolved(); - return Optional.ofNullable(milpStats); + return Optional.ofNullable(mipStats); } public boolean isSolved() { @@ -254,7 +254,7 @@ void solveInternal(SolverSettings settings) { this.solveTime = r.solveTime(); this.solvedBy = r.solvedBy(); this.lpStats = r.lpStats(); - this.milpStats = r.milpStats(); + this.mipStats = r.mipStats(); this.solved = true; } diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MilpStats.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPStats.java similarity index 88% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MilpStats.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPStats.java index 1ad7c4ff20..1cff457294 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MilpStats.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPStats.java @@ -6,7 +6,7 @@ /** * Solver statistics for MILP solves. Returned by - * {@code Problem.milpStats()} (empty {@link java.util.Optional} for LP-only problems). + * {@code Problem.mipStats()} (empty {@link java.util.Optional} for LP-only problems). * * @param mipGap relative MIP gap at termination ({@code (UB - LB) / |UB|}) * @param bestBound best dual bound found @@ -15,7 +15,7 @@ * @param presolveTime wall-clock time spent in presolve, seconds * @param rootRelaxationTime wall-clock time spent on the root LP relaxation, seconds */ -public record MilpStats( +public record MIPStats( double mipGap, double bestBound, long nodesExplored, diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java index f3b3ca9c90..c4ebfea83a 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java @@ -77,7 +77,7 @@ public final class Problem implements AutoCloseable { private double solveTime; private SolverMethod solvedBy; private LpStats lpStats; - private MilpStats milpStats; + private MIPStats mipStats; private boolean closed = false; @@ -225,14 +225,14 @@ public int numNonZeros() { return n; } - public boolean isMip() { + public boolean isMIP() { for (Variable v : variables) { if (v.variableType() != VType.CONTINUOUS) return true; } return false; } - public boolean isQp() { + public boolean isQP() { return quadraticObjective != null && quadraticObjective.numQuadraticTerms() > 0; } @@ -292,13 +292,9 @@ public SolverMethod solvedBy() { } public ProblemCategory problemCategory() { - if (isQp()) return ProblemCategory.QP; - if (!isMip()) return ProblemCategory.LP; - // MIP vs IP: IP if all variables are integer - for (Variable v : variables) { - if (v.variableType() == VType.CONTINUOUS) return ProblemCategory.MIP; - } - return ProblemCategory.IP; + if (isQP()) return ProblemCategory.QP; + if (!isMIP()) return ProblemCategory.LP; + return ProblemCategory.MIP; } public LpStats lpStats() { @@ -306,9 +302,9 @@ public LpStats lpStats() { return lpStats; } - public Optional milpStats() { + public Optional mipStats() { checkSolved(); - return Optional.ofNullable(milpStats); + return Optional.ofNullable(mipStats); } public boolean isSolved() { @@ -404,7 +400,7 @@ private void populateFromResult(SolveResult r) { this.solveTime = r.solveTime(); this.solvedBy = r.solvedBy(); this.lpStats = r.lpStats(); - this.milpStats = r.milpStats(); + this.mipStats = r.mipStats(); } // LinearExpr copy used at addConstraint time so the user's diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java index 207b66cf48..ffa18cf2f9 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java @@ -11,9 +11,7 @@ public enum ProblemCategory { /** Linear program: linear objective, linear constraints, all continuous variables. */ LP, - /** Integer program: linear objective and constraints, all variables integer. */ - IP, - /** Mixed-integer (linear) program: at least one continuous and one integer variable. */ + /** Mixed-integer (linear) program: at least one integer/binary variable. */ MIP, /** Quadratic program: quadratic objective, linear constraints. */ QP diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java index 808dc893c1..881a43c3e2 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java @@ -6,7 +6,7 @@ import com.nvidia.cuopt.linear_programming.ErrorStatus; import com.nvidia.cuopt.linear_programming.LpStats; -import com.nvidia.cuopt.linear_programming.MilpStats; +import com.nvidia.cuopt.linear_programming.MIPStats; import com.nvidia.cuopt.linear_programming.SolverMethod; import com.nvidia.cuopt.linear_programming.TerminationStatus; @@ -34,5 +34,5 @@ public record SolveResult( double solveTime, SolverMethod solvedBy, LpStats lpStats, - MilpStats milpStats + MIPStats mipStats ) {} diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CsrBuilder.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CSRBuilder.java similarity index 93% rename from java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CsrBuilder.java rename to java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CSRBuilder.java index 9fe2f9f315..8e52a636a0 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CsrBuilder.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CSRBuilder.java @@ -18,17 +18,17 @@ * *

Output arrays are ready to copy into native {@code MemorySegment}s. */ -final class CsrBuilder { +final class CSRBuilder { - private CsrBuilder() {} + private CSRBuilder() {} /** Output of CSR construction for the linear constraint matrix. */ - static final class Csr { + static final class CSR { final int[] rowOffsets; final int[] colIndices; final double[] values; - Csr(int[] rowOffsets, int[] colIndices, double[] values) { + CSR(int[] rowOffsets, int[] colIndices, double[] values) { this.rowOffsets = rowOffsets; this.colIndices = colIndices; this.values = values; @@ -40,7 +40,7 @@ static final class Csr { * expression, terms sorted by column (variable index) within each * row. Empty constraints produce a row with no non-zeros. */ - static Csr buildConstraintCsr(List rows) { + static CSR buildConstraintCSR(List rows) { int numRows = rows.size(); int[] rowOffsets = new int[numRows + 1]; @@ -78,7 +78,7 @@ static Csr buildConstraintCsr(List rows) { } } rowOffsets[numRows] = writeIdx; - return new Csr(rowOffsets, colIndices, values); + return new CSR(rowOffsets, colIndices, values); } /** @@ -90,7 +90,7 @@ static Csr buildConstraintCsr(List rows) { * *

Returns CSR with {@code numVariables + 1} row offsets. */ - static Csr buildQuadraticCsr(QuadraticExpr qexpr, int numVariables) { + static CSR buildQuadraticCSR(QuadraticExpr qexpr, int numVariables) { int n = qexpr.numQuadraticTerms(); int[] rowOffsets = new int[numVariables + 1]; @@ -131,7 +131,7 @@ static Csr buildQuadraticCsr(QuadraticExpr qexpr, int numVariables) { int end = rowOffsets[r + 1]; sortRow(colIndices, values, start, end); } - return new Csr(rowOffsets, colIndices, values); + return new CSR(rowOffsets, colIndices, values); } private static void sortRow(int[] cols, double[] vals, int start, int end) { diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java index 8403617215..4cac7d2718 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java @@ -16,7 +16,7 @@ import com.nvidia.cuopt.linear_programming.LpStats; import com.nvidia.cuopt.linear_programming.MIPGetSolutionCallback; import com.nvidia.cuopt.linear_programming.MIPSetSolutionCallback; -import com.nvidia.cuopt.linear_programming.MilpStats; +import com.nvidia.cuopt.linear_programming.MIPStats; import com.nvidia.cuopt.linear_programming.Problem; import com.nvidia.cuopt.linear_programming.QuadraticExpr; import com.nvidia.cuopt.linear_programming.SolverMethod; @@ -182,7 +182,7 @@ private ProblemBuild buildNativeProblem(Arena arena, Problem problem) { // Build constraint CSR from per-constraint LinearExprs. List rows = problem.constraintExpressions(); - CsrBuilder.Csr ccsr = CsrBuilder.buildConstraintCsr(rows); + CSRBuilder.CSR ccsr = CSRBuilder.buildConstraintCSR(rows); // Constraint sense + rhs from the Constraint metadata. byte[] sense = new byte[numC]; @@ -222,9 +222,9 @@ private ProblemBuild buildNativeProblem(Arena arena, Problem problem) { double offset = problem.objectiveOffset(); int rc; - if (problem.isQp() && problem.quadraticObjective() != null) { + if (problem.isQP() && problem.quadraticObjective() != null) { QuadraticExpr q = problem.quadraticObjective(); - CsrBuilder.Csr qcsr = CsrBuilder.buildQuadraticCsr(q, numV); + CSRBuilder.CSR qcsr = CSRBuilder.buildQuadraticCSR(q, numV); MemorySegment qRowOff = intArray(arena, qcsr.rowOffsets); MemorySegment qColIdx = intArray(arena, qcsr.colIndices); MemorySegment qVals = doubleArray(arena, qcsr.values); @@ -431,13 +431,13 @@ private SolveResult solveAndExtract(Arena arena, ProblemBuild build, LpStats lpStats = new LpStats( Double.NaN, Double.NaN, objVal, dualObjVal, -1L, Double.NaN); - MilpStats milpStats = null; + MIPStats mipStats = null; if (isMip) { cuopt_c_h.cuOptGetMIPGap(solutionHandle, outDbl); double mipGap = outDbl.get(ValueLayout.JAVA_DOUBLE, 0); cuopt_c_h.cuOptGetSolutionBound(solutionHandle, outDbl); double bound = outDbl.get(ValueLayout.JAVA_DOUBLE, 0); - milpStats = new MilpStats(mipGap, bound, -1L, -1L, Double.NaN, Double.NaN); + mipStats = new MIPStats(mipGap, bound, -1L, -1L, Double.NaN, Double.NaN); } return new SolveResult( @@ -445,7 +445,7 @@ private SolveResult solveAndExtract(Arena arena, ProblemBuild build, term, term.name(), err, errMsg, objVal, dualObjVal, solveTime, SolverMethod.UNSET, - lpStats, milpStats); + lpStats, mipStats); } finally { MemorySegment solDestroyPtr = arena.allocate(ValueLayout.ADDRESS); solDestroyPtr.set(ValueLayout.ADDRESS, 0, solutionHandle); diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java index ba699ad5c6..39e05df43a 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java @@ -41,7 +41,7 @@ void simple_knapsack_binary_milp() { problem.solve(settings); - assertTrue(problem.isMip()); + assertTrue(problem.isMIP()); // Termination should be OPTIMAL, FEASIBLE_FOUND, or a limit. TerminationStatus s = problem.status(); assertTrue(s == TerminationStatus.OPTIMAL @@ -57,7 +57,7 @@ void simple_knapsack_binary_milp() { } // MILP stats should be present. - assertTrue(problem.milpStats().isPresent()); + assertTrue(problem.mipStats().isPresent()); } } } diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java index 2511372013..38039d5804 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java @@ -54,7 +54,7 @@ void get_callback_receives_incumbents() { problem.solve(settings); - assertTrue(problem.isMip()); + assertTrue(problem.isMIP()); assertTrue(!incumbents.isEmpty(), "Get callback should have been invoked at least once"); From de14d0e002be84c7fc7f494eb0443075f9e43724 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 13 May 2026 16:29:10 -0500 Subject: [PATCH 24/28] java: shrink API surface per review (drop ranged constraints + DataModel) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per review feedback (chris-maes): Constraint.isRanged() / lowerBound() / upperBound() removed. Constraints now only carry (sense, rhs). The dual `Constraint` constructor for ranged constraints is gone; only the (CType, rhs) constructor remains. DataModel.java removed entirely. Users construct problems via the `Problem` modeling API. Cascade removals: - CuOptProvider.solveDataModel(DataModel, SolverSettings) — SPI - CuOptProviderImpl.solveDataModel(...) — impl - CuOptProviderImpl.buildNativeFromDataModel(...) — impl - CuOptProviderImpl.zeros() / positiveInfinities() — only used by the above - Solver.solve(DataModel) / solve(DataModel, SolverSettings) — convenience entry - The orphaned `solveAndExtract(Arena, ProblemBuild, ...)` overload - SolveResult javadoc reference to DataModel → Problem Build still green; the existing IT suite continues to compile against the Problem modeling API (DataModel was never used by tests). --- .../main/java/com/nvidia/cuopt/Solver.java | 23 +- .../cuopt/linear_programming/Constraint.java | 79 +---- .../cuopt/linear_programming/DataModel.java | 292 ------------------ .../com/nvidia/cuopt/spi/CuOptProvider.java | 7 - .../com/nvidia/cuopt/spi/SolveResult.java | 2 +- .../cuopt/internal/CuOptProviderImpl.java | 106 ------- 6 files changed, 9 insertions(+), 500 deletions(-) delete mode 100644 java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java index 1e6328d61b..804df2ec9c 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java @@ -4,11 +4,9 @@ */ package com.nvidia.cuopt; -import com.nvidia.cuopt.linear_programming.DataModel; import com.nvidia.cuopt.linear_programming.Problem; import com.nvidia.cuopt.linear_programming.SolverSettings; import com.nvidia.cuopt.spi.CuOptProvider; -import java.lang.reflect.Method; /** * Static utility entry points for cuopt-java. @@ -16,8 +14,7 @@ *

Most users call {@link Problem#solve()} or * {@link Problem#solve(SolverSettings)} on a Problem directly. The * static {@code Solver.solve(...)} overloads here are convenience - * wrappers that match cuOpt Python's {@code Solver.Solve(dm, settings)} - * call shape. + * wrappers. */ public final class Solver { @@ -42,22 +39,4 @@ public static void solve(Problem problem) { public static void solve(Problem problem, SolverSettings settings) { problem.solve(settings); } - - public static void solve(DataModel dm) { - solve(dm, null); - } - - public static void solve(DataModel dm, SolverSettings settings) { - // Package-private call on DataModel — Solver lives in com.nvidia.cuopt, - // DataModel lives in com.nvidia.cuopt.linear_programming, so we go - // through reflection to access solveInternal. Replace with a public - // SPI entry point or move Solver into the same package later. - try { - Method m = DataModel.class.getDeclaredMethod("solveInternal", SolverSettings.class); - m.setAccessible(true); - m.invoke(dm, settings); - } catch (ReflectiveOperationException e) { - throw new CuOptException("Internal: failed to dispatch DataModel.solveInternal", e); - } - } } diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java index d10b3ba980..e91649c417 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java @@ -14,42 +14,23 @@ * accessors ({@link #dualValue()}, {@link #slack()}) delegate back to * the owning Problem. * - *

Constraints can be one-sided (a single {@code rhs} with a - * {@code sense} in {@link CType}) or ranged (lower <= lhs <= upper); - * {@link #isRanged()} discriminates. + *

A constraint has a sense ({@link CType#LE}, {@link CType#GE}, + * {@link CType#EQ}) and a right-hand-side value. */ public final class Constraint { private final Problem owner; private final int index; - private final CType sense; // null for ranged constraints - private final double rhs; // single rhs for one-sided - private final double lowerBound; // for ranged - private final double upperBound; // for ranged - private final boolean ranged; + private final CType sense; + private final double rhs; private final String name; - // Package-private constructor for one-sided constraints. + // Package-private constructor. Constraint(Problem owner, int index, CType sense, double rhs, String name) { this.owner = Objects.requireNonNull(owner, "owner"); this.index = index; this.sense = Objects.requireNonNull(sense, "sense"); this.rhs = rhs; - this.lowerBound = Double.NaN; - this.upperBound = Double.NaN; - this.ranged = false; - this.name = name == null ? "" : name; - } - - // Package-private constructor for ranged constraints. - Constraint(Problem owner, int index, double lowerBound, double upperBound, String name) { - this.owner = Objects.requireNonNull(owner, "owner"); - this.index = index; - this.sense = null; - this.rhs = Double.NaN; - this.lowerBound = lowerBound; - this.upperBound = upperBound; - this.ranged = true; this.name = name == null ? "" : name; } @@ -61,62 +42,16 @@ public String name() { return name; } - /** - * Constraint sense ({@link CType#LE}, {@link CType#GE}, - * {@link CType#EQ}) for one-sided constraints. - * - * @throws IllegalStateException if this is a ranged constraint. - */ + /** Constraint sense ({@link CType#LE}, {@link CType#GE}, {@link CType#EQ}). */ public CType sense() { - if (ranged) { - throw new IllegalStateException( - "sense() is not defined for ranged constraints; use lowerBound()/upperBound()"); - } return sense; } - /** - * Right-hand side for one-sided constraints. - * - * @throws IllegalStateException if this is a ranged constraint. - */ + /** Right-hand side of the constraint. */ public double rhs() { - if (ranged) { - throw new IllegalStateException( - "rhs() is not defined for ranged constraints; use lowerBound()/upperBound()"); - } return rhs; } - /** Whether this is a ranged constraint (lower <= lhs <= upper). */ - public boolean isRanged() { - return ranged; - } - - /** - * Lower bound for ranged constraints. For one-sided constraints, - * returns the appropriate one-sided bound (e.g. rhs for GE; -infinity for LE). - */ - public double lowerBound() { - if (ranged) return lowerBound; - return switch (sense) { - case LE -> Double.NEGATIVE_INFINITY; - case GE, EQ -> rhs; - }; - } - - /** - * Upper bound for ranged constraints. For one-sided constraints, - * returns the appropriate one-sided bound (e.g. rhs for LE; +infinity for GE). - */ - public double upperBound() { - if (ranged) return upperBound; - return switch (sense) { - case LE, EQ -> rhs; - case GE -> Double.POSITIVE_INFINITY; - }; - } - // ── post-solve accessors ───────────────────────────────────── /** diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java deleted file mode 100644 index e2afff8e4d..0000000000 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/DataModel.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - */ -package com.nvidia.cuopt.linear_programming; - -import com.nvidia.cuopt.CuOptException; -import com.nvidia.cuopt.spi.CuOptProvider; -import com.nvidia.cuopt.spi.SolveResult; -import java.util.Optional; - -/** - * Low-level escape-hatch API matching cuOpt's Python - * {@code data_model.DataModel}. Use this when you already have - * CSR-format constraint matrices (e.g., from MPS parsing or - * programmatic generation) and don't want the {@link Problem} modeling - * layer. - * - *

All setters return {@code this} for chaining. Bulk-array - * arguments are not defensively copied — do not mutate the supplied - * arrays before {@code Solver.solve(dm)} is called. - * - *

{@code
- *   try (var dm = new DataModel()) {
- *       dm.setCsrConstraintMatrix(values, indices, offsets)
- *         .setObjectiveCoefficients(c)
- *         .setVariableLowerBounds(lb)
- *         .setVariableUpperBounds(ub)
- *         .setRowTypes(new CType[]{CType.LE, CType.GE});
- *
- *       Solver.solve(dm);
- *
- *       System.out.println(dm.status());
- *       System.out.println(java.util.Arrays.toString(dm.primalSolution()));
- *   }
- * }
- */ -public final class DataModel implements AutoCloseable { - - // ── problem definition ─────────────────────────────────────── - private boolean maximize = false; - private double objectiveOffset = 0.0; - private double[] objectiveCoefficients; - private double[] constraintMatrixValues; - private int[] constraintMatrixIndices; - private int[] constraintMatrixOffsets; - private double[] quadraticObjectiveValues; - private int[] quadraticObjectiveIndices; - private int[] quadraticObjectiveOffsets; - private double[] variableLowerBounds; - private double[] variableUpperBounds; - private double[] constraintLowerBounds; - private double[] constraintUpperBounds; - private double[] constraintBounds; // for one-sided (single rhs) - private CType[] rowTypes; - private VType[] variableTypes; - private String problemName = ""; - private String[] variableNames; - private String[] rowNames; - private String objectiveName = ""; - - // ── post-solve state ───────────────────────────────────────── - private boolean solved = false; - private double[] primalSolution; - private double[] dualSolution; - private double[] reducedCost; - private TerminationStatus status; - private String terminationReason; - private ErrorStatus errorStatus; - private String errorMessage; - private double objectiveValue; - private double dualObjectiveValue; - private double solveTime; - private SolverMethod solvedBy; - private LpStats lpStats; - private MIPStats mipStats; - - private boolean closed = false; - - public DataModel() {} - - // ── builder-style setters (chainable) ──────────────────────── - - public DataModel setMaximize(boolean maximize) { - this.maximize = maximize; - return this; - } - - public DataModel setObjectiveOffset(double offset) { - this.objectiveOffset = offset; - return this; - } - - public DataModel setObjectiveCoefficients(double[] c) { - this.objectiveCoefficients = c; - return this; - } - - public DataModel setCsrConstraintMatrix(double[] values, int[] indices, int[] offsets) { - this.constraintMatrixValues = values; - this.constraintMatrixIndices = indices; - this.constraintMatrixOffsets = offsets; - return this; - } - - public DataModel setQuadraticObjectiveMatrix(double[] values, int[] indices, int[] offsets) { - this.quadraticObjectiveValues = values; - this.quadraticObjectiveIndices = indices; - this.quadraticObjectiveOffsets = offsets; - return this; - } - - public DataModel setVariableLowerBounds(double[] lb) { - this.variableLowerBounds = lb; - return this; - } - - public DataModel setVariableUpperBounds(double[] ub) { - this.variableUpperBounds = ub; - return this; - } - - public DataModel setConstraintLowerBounds(double[] lb) { - this.constraintLowerBounds = lb; - return this; - } - - public DataModel setConstraintUpperBounds(double[] ub) { - this.constraintUpperBounds = ub; - return this; - } - - /** Sets one-sided rhs (use together with {@link #setRowTypes(CType[])}). */ - public DataModel setConstraintBounds(double[] b) { - this.constraintBounds = b; - return this; - } - - public DataModel setRowTypes(CType[] types) { - this.rowTypes = types; - return this; - } - - public DataModel setVariableTypes(VType[] types) { - this.variableTypes = types; - return this; - } - - public DataModel setProblemName(String name) { - this.problemName = name == null ? "" : name; - return this; - } - - public DataModel setVariableNames(String[] names) { - this.variableNames = names; - return this; - } - - public DataModel setRowNames(String[] names) { - this.rowNames = names; - return this; - } - - public DataModel setObjectiveName(String name) { - this.objectiveName = name == null ? "" : name; - return this; - } - - // ── post-solve accessors ───────────────────────────────────── - - public double[] primalSolution() { - checkSolved(); - return primalSolution; - } - - public double[] dualSolution() { - checkSolved(); - return dualSolution; - } - - public double[] reducedCost() { - checkSolved(); - return reducedCost; - } - - public TerminationStatus status() { - checkSolved(); - return status; - } - - public String terminationReason() { - checkSolved(); - return terminationReason; - } - - public ErrorStatus errorStatus() { - checkSolved(); - return errorStatus; - } - - public Optional errorMessage() { - checkSolved(); - return Optional.ofNullable(errorMessage); - } - - public double objectiveValue() { - checkSolved(); - return objectiveValue; - } - - public double dualObjectiveValue() { - checkSolved(); - return dualObjectiveValue; - } - - public double solveTime() { - checkSolved(); - return solveTime; - } - - public SolverMethod solvedBy() { - checkSolved(); - return solvedBy; - } - - public LpStats lpStats() { - checkSolved(); - return lpStats; - } - - public Optional mipStats() { - checkSolved(); - return Optional.ofNullable(mipStats); - } - - public boolean isSolved() { - return solved; - } - - // ── solve entry point (used by Solver.solve(dm)) ───────────── - - void solveInternal(SolverSettings settings) { - if (closed) throw new CuOptException("DataModel has been closed"); - SolveResult r = CuOptProvider.instance().solveDataModel(this, settings); - this.primalSolution = r.primalSolution(); - this.dualSolution = r.dualSolution(); - this.reducedCost = r.reducedCost(); - this.status = r.terminationStatus(); - this.terminationReason = r.terminationReason(); - this.errorStatus = r.errorStatus(); - this.errorMessage = r.errorMessage(); - this.objectiveValue = r.objectiveValue(); - this.dualObjectiveValue = r.dualObjectiveValue(); - this.solveTime = r.solveTime(); - this.solvedBy = r.solvedBy(); - this.lpStats = r.lpStats(); - this.mipStats = r.mipStats(); - this.solved = true; - } - - // ── internal accessors used by the FFM implementation - // (public for cross-package access from internal/; not part of - // the stable user-facing API — do not rely on these in user code) ─ - - public boolean maximize() { return maximize; } - public double objectiveOffset() { return objectiveOffset; } - public double[] objectiveCoefficients() { return objectiveCoefficients; } - public double[] constraintMatrixValues() { return constraintMatrixValues; } - public int[] constraintMatrixIndices() { return constraintMatrixIndices; } - public int[] constraintMatrixOffsets() { return constraintMatrixOffsets; } - public double[] quadraticObjectiveValues() { return quadraticObjectiveValues; } - public int[] quadraticObjectiveIndices() { return quadraticObjectiveIndices; } - public int[] quadraticObjectiveOffsets() { return quadraticObjectiveOffsets; } - public double[] variableLowerBounds() { return variableLowerBounds; } - public double[] variableUpperBounds() { return variableUpperBounds; } - public double[] constraintLowerBounds() { return constraintLowerBounds; } - public double[] constraintUpperBounds() { return constraintUpperBounds; } - public double[] constraintBoundsArray() { return constraintBounds; } - public CType[] rowTypes() { return rowTypes; } - public VType[] variableTypes() { return variableTypes; } - public String problemName() { return problemName; } - - @Override - public void close() { - closed = true; - } - - private void checkSolved() { - if (closed) throw new CuOptException("DataModel has been closed"); - if (!solved) throw new CuOptException("DataModel has not been solved"); - } -} diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java index 791ad29e69..7f86dddb0a 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java @@ -5,7 +5,6 @@ package com.nvidia.cuopt.spi; import com.nvidia.cuopt.CuOptException; -import com.nvidia.cuopt.linear_programming.DataModel; import com.nvidia.cuopt.linear_programming.Problem; import com.nvidia.cuopt.linear_programming.SolverSettings; import java.util.ServiceLoader; @@ -58,12 +57,6 @@ public interface CuOptProvider { */ SolveResult solveProblem(Problem problem, SolverSettings settings); - /** - * Solves the given DataModel directly (low-level path). Builds the - * native problem handle from the DataModel's CSR arrays. - */ - SolveResult solveDataModel(DataModel dm, SolverSettings settings); - // ── lookup ─────────────────────────────────────────────────── /** diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java index 881a43c3e2..0554dd283c 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java @@ -13,7 +13,7 @@ /** * Internal data carrier from the FFM implementation back to the * {@link com.nvidia.cuopt.linear_programming.Problem} or - * {@link com.nvidia.cuopt.linear_programming.DataModel} that requested + * {@link com.nvidia.cuopt.linear_programming.Problem} that requested * the solve. Pre-extracted from the native {@code cuOptSolution} * handle before that handle is freed. * diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java index 4cac7d2718..f2b3bac97c 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java @@ -10,7 +10,6 @@ import com.nvidia.cuopt.internal.panama.cuopt_c_h; import com.nvidia.cuopt.linear_programming.CType; import com.nvidia.cuopt.linear_programming.Constraint; -import com.nvidia.cuopt.linear_programming.DataModel; import com.nvidia.cuopt.linear_programming.ErrorStatus; import com.nvidia.cuopt.linear_programming.LinearExpr; import com.nvidia.cuopt.linear_programming.LpStats; @@ -129,15 +128,6 @@ public SolveResult solveProblem(Problem problem, SolverSettings settings) { } } - @Override - public SolveResult solveDataModel(DataModel dm, SolverSettings settings) { - try (Arena arena = Arena.ofConfined()) { - ProblemBuild build = buildNativeFromDataModel(arena, dm); - return solveAndExtract(arena, build, settings, dm.constraintMatrixOffsets() == null - ? 0 : Math.max(0, dm.constraintMatrixOffsets().length - 1), - dm.objectiveCoefficients() == null ? 0 : dm.objectiveCoefficients().length); - } - } // ── native problem construction from Problem (modeling API) ── @@ -246,89 +236,6 @@ private ProblemBuild buildNativeProblem(Arena arena, Problem problem) { return new ProblemBuild(handle, numV, numC); } - private ProblemBuild buildNativeFromDataModel(Arena arena, DataModel dm) { - int numV = dm.objectiveCoefficients() == null ? 0 : dm.objectiveCoefficients().length; - int numC = dm.constraintMatrixOffsets() == null - ? 0 : Math.max(0, dm.constraintMatrixOffsets().length - 1); - - MemorySegment objCoeffsSeg = doubleArray(arena, dm.objectiveCoefficients()); - MemorySegment rowOffsetsSeg = intArray(arena, dm.constraintMatrixOffsets()); - MemorySegment colIndicesSeg = intArray(arena, dm.constraintMatrixIndices()); - MemorySegment ccoeffsSeg = doubleArray(arena, dm.constraintMatrixValues()); - - double[] varLb = dm.variableLowerBounds() != null - ? dm.variableLowerBounds() : zeros(numV); - double[] varUb = dm.variableUpperBounds() != null - ? dm.variableUpperBounds() : positiveInfinities(numV); - MemorySegment lbSeg = doubleArray(arena, varLb); - MemorySegment ubSeg = doubleArray(arena, varUb); - - byte[] varTypeArr = new byte[numV]; - if (dm.variableTypes() != null) { - for (int i = 0; i < numV; i++) { - varTypeArr[i] = (byte) dm.variableTypes()[i].code(); - } - } else { - java.util.Arrays.fill(varTypeArr, (byte) 'C'); - } - MemorySegment varTypesSeg = byteArray(arena, varTypeArr); - - int senseCode = dm.maximize() ? -1 : 1; - double offset = dm.objectiveOffset(); - MemorySegment problemPtr = arena.allocate(ValueLayout.ADDRESS); - - boolean ranged = dm.constraintLowerBounds() != null || dm.constraintUpperBounds() != null; - boolean quadratic = dm.quadraticObjectiveOffsets() != null - && dm.quadraticObjectiveOffsets().length > 0; - - int rc; - if (quadratic && ranged) { - rc = cuopt_c_h.cuOptCreateQuadraticRangedProblem( - numC, numV, senseCode, offset, objCoeffsSeg, - intArray(arena, dm.quadraticObjectiveOffsets()), - intArray(arena, dm.quadraticObjectiveIndices()), - doubleArray(arena, dm.quadraticObjectiveValues()), - rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, - doubleArray(arena, dm.constraintLowerBounds()), - doubleArray(arena, dm.constraintUpperBounds()), - lbSeg, ubSeg, problemPtr); - checkRc(rc, "cuOptCreateQuadraticRangedProblem"); - } else if (quadratic) { - byte[] senseArr = ctypesToBytes(dm.rowTypes(), numC); - double[] rhsArr = dm.constraintBoundsArray() != null - ? dm.constraintBoundsArray() : zeros(numC); - rc = cuopt_c_h.cuOptCreateQuadraticProblem( - numC, numV, senseCode, offset, objCoeffsSeg, - intArray(arena, dm.quadraticObjectiveOffsets()), - intArray(arena, dm.quadraticObjectiveIndices()), - doubleArray(arena, dm.quadraticObjectiveValues()), - rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, - byteArray(arena, senseArr), doubleArray(arena, rhsArr), - lbSeg, ubSeg, problemPtr); - checkRc(rc, "cuOptCreateQuadraticProblem"); - } else if (ranged) { - rc = cuopt_c_h.cuOptCreateRangedProblem( - numC, numV, senseCode, offset, objCoeffsSeg, - rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, - doubleArray(arena, dm.constraintLowerBounds()), - doubleArray(arena, dm.constraintUpperBounds()), - lbSeg, ubSeg, varTypesSeg, problemPtr); - checkRc(rc, "cuOptCreateRangedProblem"); - } else { - byte[] senseArr = ctypesToBytes(dm.rowTypes(), numC); - double[] rhsArr = dm.constraintBoundsArray() != null - ? dm.constraintBoundsArray() : zeros(numC); - rc = cuopt_c_h.cuOptCreateProblem( - numC, numV, senseCode, offset, objCoeffsSeg, - rowOffsetsSeg, colIndicesSeg, ccoeffsSeg, - byteArray(arena, senseArr), doubleArray(arena, rhsArr), - lbSeg, ubSeg, varTypesSeg, problemPtr); - checkRc(rc, "cuOptCreateProblem"); - } - - long handle = problemPtr.get(ValueLayout.ADDRESS, 0).address(); - return new ProblemBuild(handle, numV, numC); - } // ── solve + extract ───────────────────────────────────────── @@ -338,10 +245,6 @@ private SolveResult solveAndExtract(Arena arena, Problem problem, problem); } - private SolveResult solveAndExtract(Arena arena, ProblemBuild build, - SolverSettings settings, int numC, int numV) { - return solveAndExtract(arena, build, settings, numC, numV, null); - } private SolveResult solveAndExtract(Arena arena, ProblemBuild build, SolverSettings settings, int numC, int numV, @@ -589,15 +492,6 @@ private static byte[] ctypesToBytes(CType[] types, int n) { return out; } - private static double[] zeros(int n) { - return new double[n]; - } - - private static double[] positiveInfinities(int n) { - double[] out = new double[n]; - java.util.Arrays.fill(out, Double.POSITIVE_INFINITY); - return out; - } private static void checkRc(int rc, String op) { if (rc != 0) { From cd20d991c3ae865cb203422a5b4c4d4cd51689de Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 13 May 2026 17:42:45 -0500 Subject: [PATCH 25/28] java: lowercase brand prefix on cuOpt-named classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per review feedback (chris-maes): consistent capitalization matching the cuOpt brand (lowercase 'c'). Four classes renamed: CuOpt → cuOpt (public static constants holder) CuOptException → cuOptException (RuntimeException) CuOptProvider → cuOptProvider (sealed SPI interface) CuOptProviderImpl → cuOptProviderImpl (Java 22 FFM impl) File names updated to match (git mv), all type references updated, and the ServiceLoader registration at META-INF/services/com.nvidia.cuopt.spi.cuOptProvider renamed + content updated to point at com.nvidia.cuopt.internal.cuOptProviderImpl. Full IT suite (4 unit + 6 IT) passes locally after the rename; ServiceLoader resolves the renamed impl correctly. --- .../src/main/java/com/nvidia/cuopt/README.md | 8 ++-- .../main/java/com/nvidia/cuopt/Solver.java | 6 +-- .../nvidia/cuopt/{CuOpt.java => cuOpt.java} | 6 +-- ...uOptException.java => cuOptException.java} | 8 ++-- .../cuopt/linear_programming/Constraint.java | 6 +-- .../linear_programming/PdlpSolverMode.java | 2 +- .../cuopt/linear_programming/Problem.java | 14 +++---- .../linear_programming/SolverSettings.java | 38 +++++++++---------- .../cuopt/linear_programming/Variable.java | 6 +-- ...{CuOptProvider.java => cuOptProvider.java} | 18 ++++----- .../main/java22/com/nvidia/cuopt/README.md | 2 +- .../cuopt/internal/NativeLibraryLoader.java | 12 +++--- ...oviderImpl.java => cuOptProviderImpl.java} | 14 +++---- .../com.nvidia.cuopt.spi.CuOptProvider | 1 - .../com.nvidia.cuopt.spi.cuOptProvider | 1 + .../linear_programming/LinearExprTest.java | 2 +- .../cuopt/linear_programming/LpSolverIT.java | 2 +- .../linear_programming/MilpSolverIT.java | 2 +- .../linear_programming/MipCallbackIT.java | 2 +- .../cuopt/linear_programming/QpSolverIT.java | 2 +- 20 files changed, 76 insertions(+), 76 deletions(-) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{CuOpt.java => cuOpt.java} (97%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{CuOptException.java => cuOptException.java} (72%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/{CuOptProvider.java => cuOptProvider.java} (87%) rename java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/{CuOptProviderImpl.java => cuOptProviderImpl.java} (98%) delete mode 100644 java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.CuOptProvider create mode 100644 java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.cuOptProvider diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/README.md b/java/cuopt-java/src/main/java/com/nvidia/cuopt/README.md index 6c7e6498c7..abd2daeab1 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/README.md +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/README.md @@ -8,8 +8,8 @@ classes don't exist in Java 21. - The user-facing API: `Solver` (currently exposes `getVersion()` only; `Problem`, `Variable`, `LinearExpr`, etc. land in subsequent PRs). -- Public exceptions: `CuOptException`. -- The SPI interface (`spi/CuOptProvider.java`) — sealed; permits only the +- Public exceptions: `cuOptException`. +- The SPI interface (`spi/cuOptProvider.java`) — sealed; permits only the Java 22 implementation in `internal/`. ## How calls reach the FFM implementation @@ -19,12 +19,12 @@ Layer 5 calls the SPI: ```java public final class Solver { public static String getVersion() { - return CuOptProvider.instance().getVersion(); + return cuOptProvider.instance().getVersion(); } } ``` -`CuOptProvider.instance()` uses `java.util.ServiceLoader` to find the +`cuOptProvider.instance()` uses `java.util.ServiceLoader` to find the implementation registered in `META-INF/services/`. On a Java 22+ JVM, the registered class lives in `META-INF/versions/22/com/nvidia/cuopt/internal/` (the multi-release JAR layer), so the JVM picks it up automatically. diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java index 804df2ec9c..9356a07a7d 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java @@ -6,7 +6,7 @@ import com.nvidia.cuopt.linear_programming.Problem; import com.nvidia.cuopt.linear_programming.SolverSettings; -import com.nvidia.cuopt.spi.CuOptProvider; +import com.nvidia.cuopt.spi.cuOptProvider; /** * Static utility entry points for cuopt-java. @@ -24,10 +24,10 @@ private Solver() {} * Returns the cuOpt library version (from {@code libcuopt.so}) as a * human-readable {@code major.minor.patch} string. * - * @throws CuOptException if the native library cannot be loaded. + * @throws cuOptException if the native library cannot be loaded. */ public static String getVersion() { - return CuOptProvider.instance().getVersion(); + return cuOptProvider.instance().getVersion(); } // ── solve overloads ────────────────────────────────────────── diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOpt.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOpt.java similarity index 97% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOpt.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOpt.java index 4b1c455b8f..51011ba791 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOpt.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOpt.java @@ -12,7 +12,7 @@ * Constants holder for cuopt-java. Designed for static import: * *
{@code
- *     import static com.nvidia.cuopt.CuOpt.*;
+ *     import static com.nvidia.cuopt.cuOpt.*;
  *
  *     Variable x = problem.addVariable(0, INF, CONTINUOUS, "x");
  *     problem.addConstraint(expr, LESS_EQUAL, 100, "c1");
@@ -24,9 +24,9 @@
  * grouped at the bottom. They're used with
  * {@link com.nvidia.cuopt.linear_programming.SolverSettings#setParameter(String, Object)}.
  */
-public final class CuOpt {
+public final class cuOpt {
 
-    private CuOpt() {}
+    private cuOpt() {}
 
     // ── numeric constants ────────────────────────────────────────
     /** Positive infinity, for unbounded variable / constraint sides. */
diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOptException.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOptException.java
similarity index 72%
rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOptException.java
rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOptException.java
index cd5e908f3c..c67ea66593 100644
--- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/CuOptException.java
+++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOptException.java
@@ -9,19 +9,19 @@
  * the runtime environment is misconfigured (e.g., the native library
  * cannot be loaded, or the JVM is older than Java 22).
  */
-public class CuOptException extends RuntimeException {
+public class cuOptException extends RuntimeException {
 
     private static final long serialVersionUID = 1L;
 
-    public CuOptException(String message) {
+    public cuOptException(String message) {
         super(message);
     }
 
-    public CuOptException(String message, Throwable cause) {
+    public cuOptException(String message, Throwable cause) {
         super(message, cause);
     }
 
-    public CuOptException(Throwable cause) {
+    public cuOptException(Throwable cause) {
         super(cause);
     }
 }
diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java
index e91649c417..e754611d5f 100644
--- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java
+++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java
@@ -4,7 +4,7 @@
  */
 package com.nvidia.cuopt.linear_programming;
 
-import com.nvidia.cuopt.CuOptException;
+import com.nvidia.cuopt.cuOptException;
 import java.util.Objects;
 
 /**
@@ -58,7 +58,7 @@ public double rhs() {
      * Dual value (shadow price) of this constraint in the current
      * LP solution. LP only — for MIP solves, returns {@code Double.NaN}.
      *
-     * @throws CuOptException if the owning Problem has not been solved
+     * @throws cuOptException if the owning Problem has not been solved
      *                        or has been closed.
      */
     public double dualValue() {
@@ -68,7 +68,7 @@ public double dualValue() {
     /**
      * Slack of this constraint in the current solution.
      *
-     * @throws CuOptException if the owning Problem has not been solved
+     * @throws cuOptException if the owning Problem has not been solved
      *                        or has been closed.
      */
     public double slack() {
diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java
index df3d9393fc..5a89a48533 100644
--- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java
+++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java
@@ -6,7 +6,7 @@
 
 /**
  * PDLP-specific solver mode tuning. Set via
- * {@code SolverSettings.setParameter(CuOpt.PDLP_SOLVER_MODE, mode)}.
+ * {@code SolverSettings.setParameter(cuOpt.PDLP_SOLVER_MODE, mode)}.
  *
  * 

Maps to the C API constants {@code CUOPT_PDLP_SOLVER_MODE_*}. */ diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java index c4ebfea83a..e31d313648 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java @@ -4,8 +4,8 @@ */ package com.nvidia.cuopt.linear_programming; -import com.nvidia.cuopt.CuOptException; -import com.nvidia.cuopt.spi.CuOptProvider; +import com.nvidia.cuopt.cuOptException; +import com.nvidia.cuopt.spi.cuOptProvider; import com.nvidia.cuopt.spi.SolveResult; import java.util.ArrayList; import java.util.HashMap; @@ -25,7 +25,7 @@ * (status, objective, stats) via accessors on this class. * *

{@code
- *   import static com.nvidia.cuopt.CuOpt.*;
+ *   import static com.nvidia.cuopt.cuOpt.*;
  *
  *   try (var problem = new Problem("diet")) {
  *       Variable x = problem.addVariable(0, INF, CONTINUOUS, "x");
@@ -244,7 +244,7 @@ public void solve() {
 
     public void solve(SolverSettings settings) {
         checkOpen();
-        SolveResult result = CuOptProvider.instance().solveProblem(this, settings);
+        SolveResult result = cuOptProvider.instance().solveProblem(this, settings);
         populateFromResult(result);
         this.solved = true;
     }
@@ -373,17 +373,17 @@ public List constraintExpressions() {
     // ── helpers ──────────────────────────────────────────────────
 
     private void checkOpen() {
-        if (closed) throw new CuOptException("Problem has been closed");
+        if (closed) throw new cuOptException("Problem has been closed");
     }
 
     private void checkSolved() {
         checkOpen();
-        if (!solved) throw new CuOptException("Problem has not been solved");
+        if (!solved) throw new cuOptException("Problem has not been solved");
     }
 
     private void checkNotSolved() {
         checkOpen();
-        if (solved) throw new CuOptException("Problem has already been solved; create a new Problem to re-build");
+        if (solved) throw new cuOptException("Problem has already been solved; create a new Problem to re-build");
     }
 
     private void populateFromResult(SolveResult r) {
diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java
index e02459ded9..e2c6e0774b 100644
--- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java
+++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java
@@ -4,9 +4,9 @@
  */
 package com.nvidia.cuopt.linear_programming;
 
-import com.nvidia.cuopt.CuOpt;
-import com.nvidia.cuopt.CuOptException;
-import com.nvidia.cuopt.spi.CuOptProvider;
+import com.nvidia.cuopt.cuOpt;
+import com.nvidia.cuopt.cuOptException;
+import com.nvidia.cuopt.spi.cuOptProvider;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Objects;
@@ -43,50 +43,50 @@ public final class SolverSettings implements AutoCloseable {
     private MIPSetSolutionCallback mipSetCallback;
 
     public SolverSettings() {
-        this.nativeHandle = CuOptProvider.instance().createSolverSettings();
+        this.nativeHandle = cuOptProvider.instance().createSolverSettings();
     }
 
     // ── typed setters (top-frequency parameters) ─────────────────
 
     public SolverSettings setTimeLimit(double seconds) {
-        return setFloatParameter(CuOpt.TIME_LIMIT, seconds);
+        return setFloatParameter(cuOpt.TIME_LIMIT, seconds);
     }
 
     public SolverSettings setIterationLimit(long iterations) {
-        return setIntegerParameter(CuOpt.ITERATION_LIMIT, iterations);
+        return setIntegerParameter(cuOpt.ITERATION_LIMIT, iterations);
     }
 
     public SolverSettings setOptimalityTolerance(double eps) {
         // Cuopt's "optimality tolerance" is the relative gap tolerance.
-        return setFloatParameter(CuOpt.RELATIVE_GAP_TOLERANCE, eps);
+        return setFloatParameter(cuOpt.RELATIVE_GAP_TOLERANCE, eps);
     }
 
     public SolverSettings setMethod(SolverMethod method) {
-        return setIntegerParameter(CuOpt.METHOD, method.code());
+        return setIntegerParameter(cuOpt.METHOD, method.code());
     }
 
     public SolverSettings setPdlpSolverMode(PdlpSolverMode mode) {
-        return setIntegerParameter(CuOpt.PDLP_SOLVER_MODE, mode.code());
+        return setIntegerParameter(cuOpt.PDLP_SOLVER_MODE, mode.code());
     }
 
     public SolverSettings setRelativeMipGap(double gap) {
-        return setFloatParameter(CuOpt.MIP_RELATIVE_GAP, gap);
+        return setFloatParameter(cuOpt.MIP_RELATIVE_GAP, gap);
     }
 
     public SolverSettings setAbsoluteMipGap(double gap) {
-        return setFloatParameter(CuOpt.MIP_ABSOLUTE_GAP, gap);
+        return setFloatParameter(cuOpt.MIP_ABSOLUTE_GAP, gap);
     }
 
     public SolverSettings setLogToConsole(boolean enabled) {
-        return setIntegerParameter(CuOpt.LOG_TO_CONSOLE, enabled ? 1 : 0);
+        return setIntegerParameter(cuOpt.LOG_TO_CONSOLE, enabled ? 1 : 0);
     }
 
     public SolverSettings setNumCpuThreads(int n) {
-        return setIntegerParameter(CuOpt.NUM_CPU_THREADS, n);
+        return setIntegerParameter(cuOpt.NUM_CPU_THREADS, n);
     }
 
     public SolverSettings setRandomSeed(long seed) {
-        return setIntegerParameter(CuOpt.RANDOM_SEED, seed);
+        return setIntegerParameter(cuOpt.RANDOM_SEED, seed);
     }
 
     // ── MIP user callbacks ───────────────────────────────────────
@@ -192,21 +192,21 @@ public SolverSettings setParameter(String name, Object value) {
     public SolverSettings setIntegerParameter(String name, long value) {
         checkOpen();
         parameters.put(name, value);
-        CuOptProvider.instance().setSolverIntegerParameter(nativeHandle, name, value);
+        cuOptProvider.instance().setSolverIntegerParameter(nativeHandle, name, value);
         return this;
     }
 
     public SolverSettings setFloatParameter(String name, double value) {
         checkOpen();
         parameters.put(name, value);
-        CuOptProvider.instance().setSolverFloatParameter(nativeHandle, name, value);
+        cuOptProvider.instance().setSolverFloatParameter(nativeHandle, name, value);
         return this;
     }
 
     public SolverSettings setStringParameter(String name, String value) {
         checkOpen();
         parameters.put(name, value);
-        CuOptProvider.instance().setSolverStringParameter(nativeHandle, name, value);
+        cuOptProvider.instance().setSolverStringParameter(nativeHandle, name, value);
         return this;
     }
 
@@ -225,7 +225,7 @@ public long nativeHandle() {
 
     private void checkOpen() {
         if (closed) {
-            throw new CuOptException("SolverSettings has been closed");
+            throw new cuOptException("SolverSettings has been closed");
         }
     }
 
@@ -233,7 +233,7 @@ private void checkOpen() {
     public synchronized void close() {
         if (closed) return;
         closed = true;
-        CuOptProvider.instance().destroySolverSettings(nativeHandle);
+        cuOptProvider.instance().destroySolverSettings(nativeHandle);
         nativeHandle = 0L;
     }
 }
diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java
index 34cd805fd3..4083bbffe9 100644
--- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java
+++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java
@@ -4,7 +4,7 @@
  */
 package com.nvidia.cuopt.linear_programming;
 
-import com.nvidia.cuopt.CuOptException;
+import com.nvidia.cuopt.cuOptException;
 import java.util.Objects;
 
 /**
@@ -67,7 +67,7 @@ public VType variableType() {
     /**
      * Primal value of this variable in the current solution.
      *
-     * @throws CuOptException if the owning Problem has not been solved
+     * @throws cuOptException if the owning Problem has not been solved
      *                        or has been closed.
      */
     public double value() {
@@ -78,7 +78,7 @@ public double value() {
      * Reduced cost of this variable in the current LP solution. LP only;
      * returns {@code Double.NaN} for MIP solves.
      *
-     * @throws CuOptException if the owning Problem has not been solved
+     * @throws cuOptException if the owning Problem has not been solved
      *                        or has been closed.
      */
     public double reducedCost() {
diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/cuOptProvider.java
similarity index 87%
rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java
rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/cuOptProvider.java
index 7f86dddb0a..c879da3186 100644
--- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/CuOptProvider.java
+++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/cuOptProvider.java
@@ -4,7 +4,7 @@
  */
 package com.nvidia.cuopt.spi;
 
-import com.nvidia.cuopt.CuOptException;
+import com.nvidia.cuopt.cuOptException;
 import com.nvidia.cuopt.linear_programming.Problem;
 import com.nvidia.cuopt.linear_programming.SolverSettings;
 import java.util.ServiceLoader;
@@ -19,11 +19,11 @@
  * {@code long} values (raw addresses).
  *
  * 

The implementation lives in - * {@code com.nvidia.cuopt.internal.CuOptProviderImpl} under + * {@code com.nvidia.cuopt.internal.cuOptProviderImpl} under * {@code src/main/java22/}; the JVM resolves it via * {@link java.util.ServiceLoader} on Java 22+ runtimes. */ -public interface CuOptProvider { +public interface cuOptProvider { // ── library-level ──────────────────────────────────────────── @@ -63,22 +63,22 @@ public interface CuOptProvider { * Returns the singleton implementation, resolved via * {@link ServiceLoader}. * - * @throws CuOptException if no implementation is registered + * @throws cuOptException if no implementation is registered * (e.g., running on Java 21 — the FFM * impl lives in the Java 22 multi-release * layer of the JAR and is not visible to * Java 21 JVMs). */ - static CuOptProvider instance() { + static cuOptProvider instance() { return Holder.INSTANCE; } final class Holder { - private static final CuOptProvider INSTANCE = ServiceLoader - .load(CuOptProvider.class) + private static final cuOptProvider INSTANCE = ServiceLoader + .load(cuOptProvider.class) .findFirst() - .orElseThrow(() -> new CuOptException( - "No CuOptProvider implementation found. cuopt-java requires " + .orElseThrow(() -> new cuOptException( + "No cuOptProvider implementation found. cuopt-java requires " + "Java 22 or higher at runtime; the FFM implementation lives " + "in the Java 22 multi-release layer of the JAR and is not " + "visible to Java 21 JVMs.")); diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/README.md b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/README.md index 58dc3d666a..78d76e8929 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/README.md +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/README.md @@ -6,7 +6,7 @@ Java 22 or higher. ## Layer 3 — FFM Implementation (`internal/`) -- `CuOptProviderImpl` — the SPI implementation. Bridges Layer 5's public +- `cuOptProviderImpl` — the SPI implementation. Bridges Layer 5's public API to the panama bindings. - `NativeLibraryLoader` — loads `libcuopt.so` (or `.dll`/`.dylib`). Reads `META-INF/cuopt/supported-platforms.properties` for the platform diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java index 96e4602cdb..de4a32eeb6 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/NativeLibraryLoader.java @@ -4,7 +4,7 @@ */ package com.nvidia.cuopt.internal; -import com.nvidia.cuopt.CuOptException; +import com.nvidia.cuopt.cuOptException; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -86,7 +86,7 @@ private static void loadSystem() { try { System.loadLibrary("cuopt"); } catch (UnsatisfiedLinkError e) { - throw new CuOptException( + throw new cuOptException( "Failed to load libcuopt. Either add the directory containing " + "libcuopt.so to java.library.path (typical conda install), " + "or use a classifier JAR that bundles the native library " @@ -105,7 +105,7 @@ private static void loadEmbedded() { Path extracted = extractResource(resourcePath, libFile); System.load(extracted.toAbsolutePath().toString()); } catch (Throwable t) { - throw new CuOptException( + throw new cuOptException( "Failed to load embedded native dependency: " + libFile + " from resource path " + resourcePath, t); } @@ -160,16 +160,16 @@ private static void verifyPlatformSupported() { Properties props = new Properties(); try (InputStream in = NativeLibraryLoader.class.getResourceAsStream(PLATFORM_PROPS)) { if (in == null) { - throw new CuOptException( + throw new cuOptException( "Internal error: " + PLATFORM_PROPS + " not found in JAR."); } props.load(in); } catch (IOException e) { - throw new CuOptException("Failed to read " + PLATFORM_PROPS, e); + throw new cuOptException("Failed to read " + PLATFORM_PROPS, e); } if (!"true".equalsIgnoreCase(props.getProperty(key))) { - throw new CuOptException( + throw new cuOptException( "Unsupported platform: " + key + ". Supported platforms: " + props.stringPropertyNames()); } diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/cuOptProviderImpl.java similarity index 98% rename from java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java rename to java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/cuOptProviderImpl.java index f2b3bac97c..9bac70f903 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CuOptProviderImpl.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/cuOptProviderImpl.java @@ -4,7 +4,7 @@ */ package com.nvidia.cuopt.internal; -import com.nvidia.cuopt.CuOptException; +import com.nvidia.cuopt.cuOptException; import com.nvidia.cuopt.internal.panama.cuOptMIPGetSolutionCallback; import com.nvidia.cuopt.internal.panama.cuOptMIPSetSolutionCallback; import com.nvidia.cuopt.internal.panama.cuopt_c_h; @@ -23,7 +23,7 @@ import com.nvidia.cuopt.linear_programming.TerminationStatus; import com.nvidia.cuopt.linear_programming.VType; import com.nvidia.cuopt.linear_programming.Variable; -import com.nvidia.cuopt.spi.CuOptProvider; +import com.nvidia.cuopt.spi.cuOptProvider; import com.nvidia.cuopt.spi.SolveResult; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; @@ -32,8 +32,8 @@ import java.util.List; /** - * FFM implementation of {@link CuOptProvider}. Registered via - * {@code META-INF/services/com.nvidia.cuopt.spi.CuOptProvider}. + * FFM implementation of {@link cuOptProvider}. Registered via + * {@code META-INF/services/com.nvidia.cuopt.spi.cuOptProvider}. * *

Lives in the Java 22 multi-release layer; loaded only on JVMs at * Java 22 or higher. @@ -42,9 +42,9 @@ * addresses); this class reconstructs {@code MemorySegment} from the * addresses on each call. */ -public final class CuOptProviderImpl implements CuOptProvider { +public final class cuOptProviderImpl implements cuOptProvider { - public CuOptProviderImpl() { + public cuOptProviderImpl() { NativeLibraryLoader.ensureLoaded(); } @@ -496,7 +496,7 @@ private static byte[] ctypesToBytes(CType[] types, int n) { private static void checkRc(int rc, String op) { if (rc != 0) { ErrorStatus err = ErrorStatus.fromCode(rc); - throw new CuOptException(op + " returned non-zero status " + rc + " (" + err + ")"); + throw new cuOptException(op + " returned non-zero status " + rc + " (" + err + ")"); } } } diff --git a/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.CuOptProvider b/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.CuOptProvider deleted file mode 100644 index 058c2edc6e..0000000000 --- a/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.CuOptProvider +++ /dev/null @@ -1 +0,0 @@ -com.nvidia.cuopt.internal.CuOptProviderImpl diff --git a/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.cuOptProvider b/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.cuOptProvider new file mode 100644 index 0000000000..908b831f8a --- /dev/null +++ b/java/cuopt-java/src/main/resources/META-INF/services/com.nvidia.cuopt.spi.cuOptProvider @@ -0,0 +1 @@ +com.nvidia.cuopt.internal.cuOptProviderImpl diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java index 0dfa8f31fc..06ce518c24 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java @@ -4,7 +4,7 @@ */ package com.nvidia.cuopt.linear_programming; -import static com.nvidia.cuopt.CuOpt.*; +import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java index c1cd229650..d4504bb327 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java @@ -4,7 +4,7 @@ */ package com.nvidia.cuopt.linear_programming; -import static com.nvidia.cuopt.CuOpt.*; +import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java index 39e05df43a..4e9dca7d2a 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java @@ -4,7 +4,7 @@ */ package com.nvidia.cuopt.linear_programming; -import static com.nvidia.cuopt.CuOpt.*; +import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java index 38039d5804..1639daf724 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java @@ -4,7 +4,7 @@ */ package com.nvidia.cuopt.linear_programming; -import static com.nvidia.cuopt.CuOpt.*; +import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java index 1d27e49006..67931f4234 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java @@ -4,7 +4,7 @@ */ package com.nvidia.cuopt.linear_programming; -import static com.nvidia.cuopt.CuOpt.*; +import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; From 492500812d4db1d411afe3a3c6de0d43fedb24fd Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 14 May 2026 10:12:50 -0500 Subject: [PATCH 26/28] =?UTF-8?q?java:=20rename=20linear=5Fprogramming=20p?= =?UTF-8?q?ackage=20=E2=86=92=20optimization=20(+=20MIPCallbackIT)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per review feedback (chris-maes): com.nvidia.cuopt.linear_programming → com.nvidia.cuopt.optimization Reviewer's reasoning: cuOpt covers more than linear programming now (routing, etc.), so `linear_programming` is a misleading namespace. The new `com.nvidia.cuopt.optimization` is broad enough to host the LP/MILP/QP API alongside future siblings (e.g. `com.nvidia.cuopt.routing`). Also renames the MIP callback IT class: MipCallbackIT → MIPCallbackIT Cascade: 18 main classes + 5 test classes moved from linear_programming/ to optimization/, and ~10 files outside the package updated their imports. Full IT suite (4 unit + 6 IT) passes locally after the rename. The C-side header path (`cpp/include/cuopt/linear_programming/cuopt_c.h`) is unchanged — only the Java package was renamed. --- .../main/java/com/nvidia/cuopt/Solver.java | 4 +-- .../src/main/java/com/nvidia/cuopt/cuOpt.java | 8 ++--- .../CType.java | 2 +- .../Constraint.java | 2 +- .../ErrorStatus.java | 2 +- .../LinearExpr.java | 2 +- .../LpStats.java | 2 +- .../MIPGetSolutionCallback.java | 2 +- .../MIPSetSolutionCallback.java | 2 +- .../MIPStats.java | 2 +- .../PdlpSolverMode.java | 2 +- .../Problem.java | 2 +- .../ProblemCategory.java | 2 +- .../QuadraticExpr.java | 2 +- .../Sense.java | 2 +- .../SolverMethod.java | 2 +- .../SolverSettings.java | 2 +- .../TerminationStatus.java | 2 +- .../VType.java | 2 +- .../Variable.java | 2 +- .../com/nvidia/cuopt/spi/SolveResult.java | 14 ++++----- .../com/nvidia/cuopt/spi/cuOptProvider.java | 4 +-- .../com/nvidia/cuopt/internal/CSRBuilder.java | 6 ++-- .../cuopt/internal/cuOptProviderImpl.java | 30 +++++++++---------- .../LinearExprTest.java | 2 +- .../LpSolverIT.java | 2 +- .../MIPCallbackIT.java} | 4 +-- .../MilpSolverIT.java | 2 +- .../QpSolverIT.java | 2 +- 29 files changed, 57 insertions(+), 57 deletions(-) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/CType.java (94%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/Constraint.java (98%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/ErrorStatus.java (96%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/LinearExpr.java (98%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/LpStats.java (95%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/MIPGetSolutionCallback.java (96%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/MIPSetSolutionCallback.java (97%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/MIPStats.java (95%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/PdlpSolverMode.java (95%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/Problem.java (99%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/ProblemCategory.java (92%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/QuadraticExpr.java (99%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/Sense.java (92%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/SolverMethod.java (95%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/SolverSettings.java (99%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/TerminationStatus.java (95%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/VType.java (94%) rename java/cuopt-java/src/main/java/com/nvidia/cuopt/{linear_programming => optimization}/Variable.java (98%) rename java/cuopt-java/src/test/java/com/nvidia/cuopt/{linear_programming => optimization}/LinearExprTest.java (97%) rename java/cuopt-java/src/test/java/com/nvidia/cuopt/{linear_programming => optimization}/LpSolverIT.java (98%) rename java/cuopt-java/src/test/java/com/nvidia/cuopt/{linear_programming/MipCallbackIT.java => optimization/MIPCallbackIT.java} (98%) rename java/cuopt-java/src/test/java/com/nvidia/cuopt/{linear_programming => optimization}/MilpSolverIT.java (97%) rename java/cuopt-java/src/test/java/com/nvidia/cuopt/{linear_programming => optimization}/QpSolverIT.java (97%) diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java index 9356a07a7d..5428377c0e 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/Solver.java @@ -4,8 +4,8 @@ */ package com.nvidia.cuopt; -import com.nvidia.cuopt.linear_programming.Problem; -import com.nvidia.cuopt.linear_programming.SolverSettings; +import com.nvidia.cuopt.optimization.Problem; +import com.nvidia.cuopt.optimization.SolverSettings; import com.nvidia.cuopt.spi.cuOptProvider; /** diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOpt.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOpt.java index 51011ba791..e822c43c3a 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOpt.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/cuOpt.java @@ -4,9 +4,9 @@ */ package com.nvidia.cuopt; -import com.nvidia.cuopt.linear_programming.CType; -import com.nvidia.cuopt.linear_programming.Sense; -import com.nvidia.cuopt.linear_programming.VType; +import com.nvidia.cuopt.optimization.CType; +import com.nvidia.cuopt.optimization.Sense; +import com.nvidia.cuopt.optimization.VType; /** * Constants holder for cuopt-java. Designed for static import: @@ -22,7 +22,7 @@ *

Parameter name string constants (mirrors of the C-side * {@code CUOPT_*} preprocessor macros from {@code constants.h}) are * grouped at the bottom. They're used with - * {@link com.nvidia.cuopt.linear_programming.SolverSettings#setParameter(String, Object)}. + * {@link com.nvidia.cuopt.optimization.SolverSettings#setParameter(String, Object)}. */ public final class cuOpt { diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/CType.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/CType.java similarity index 94% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/CType.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/CType.java index c5ff95c3f7..8ffd3e6935 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/CType.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/CType.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Constraint sense for {@code Problem.addConstraint(...)}. diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Constraint.java similarity index 98% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Constraint.java index e754611d5f..d4dffaf0e0 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Constraint.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Constraint.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import com.nvidia.cuopt.cuOptException; import java.util.Objects; diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ErrorStatus.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/ErrorStatus.java similarity index 96% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ErrorStatus.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/ErrorStatus.java index 1d209943bb..67b6c3981c 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ErrorStatus.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/ErrorStatus.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Solver error status, distinct from {@link TerminationStatus}. diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LinearExpr.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/LinearExpr.java similarity index 98% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LinearExpr.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/LinearExpr.java index eb9159ecbe..26cdaa321f 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LinearExpr.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/LinearExpr.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import java.util.LinkedHashMap; import java.util.Map; diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LpStats.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/LpStats.java similarity index 95% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LpStats.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/LpStats.java index 41b1a5e509..c3f836da5d 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/LpStats.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/LpStats.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Solver statistics for LP solves. Returned by {@code Problem.lpStats()}. diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPGetSolutionCallback.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPGetSolutionCallback.java similarity index 96% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPGetSolutionCallback.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPGetSolutionCallback.java index b8d7a5a1d3..bcdcc22175 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPGetSolutionCallback.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPGetSolutionCallback.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * User-provided callback invoked by the MIP solver each time a new diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPSetSolutionCallback.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPSetSolutionCallback.java similarity index 97% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPSetSolutionCallback.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPSetSolutionCallback.java index ca4f8a1b73..2f99b451ae 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPSetSolutionCallback.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPSetSolutionCallback.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * User-provided callback invoked by the MIP solver when it would like diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPStats.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPStats.java similarity index 95% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPStats.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPStats.java index 1cff457294..dcf85c1d5c 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/MIPStats.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/MIPStats.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Solver statistics for MILP solves. Returned by diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/PdlpSolverMode.java similarity index 95% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/PdlpSolverMode.java index 5a89a48533..663f38f77a 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/PdlpSolverMode.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/PdlpSolverMode.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * PDLP-specific solver mode tuning. Set via diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Problem.java similarity index 99% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Problem.java index e31d313648..73e452dd8c 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Problem.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Problem.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import com.nvidia.cuopt.cuOptException; import com.nvidia.cuopt.spi.cuOptProvider; diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/ProblemCategory.java similarity index 92% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/ProblemCategory.java index ffa18cf2f9..933aa99933 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/ProblemCategory.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/ProblemCategory.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Coarse classification of an optimization problem. Returned by diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/QuadraticExpr.java similarity index 99% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/QuadraticExpr.java index 0df63ebdbe..f8fb313682 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/QuadraticExpr.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/QuadraticExpr.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import java.util.ArrayList; import java.util.List; diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Sense.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Sense.java similarity index 92% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Sense.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Sense.java index c6cfbd7aca..98990a4040 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Sense.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Sense.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Objective sense for {@code Problem.setObjective(...)}. diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverMethod.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/SolverMethod.java similarity index 95% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverMethod.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/SolverMethod.java index f7819f487e..793551751c 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverMethod.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/SolverMethod.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Solver method selection for LP problems. diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/SolverSettings.java similarity index 99% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/SolverSettings.java index e2c6e0774b..a52351cf3c 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/SolverSettings.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/SolverSettings.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import com.nvidia.cuopt.cuOpt; import com.nvidia.cuopt.cuOptException; diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/TerminationStatus.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/TerminationStatus.java similarity index 95% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/TerminationStatus.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/TerminationStatus.java index d026f12691..06fe9bf1d6 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/TerminationStatus.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/TerminationStatus.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Solver termination status. Returned by {@code Problem.status()} after diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/VType.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/VType.java similarity index 94% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/VType.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/VType.java index 674f96f4b5..92a2e5475b 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/VType.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/VType.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; /** * Variable type for {@code Problem.addVariable(...)}. diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Variable.java similarity index 98% rename from java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java rename to java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Variable.java index 4083bbffe9..5e42f6f7f2 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/linear_programming/Variable.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/optimization/Variable.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import com.nvidia.cuopt.cuOptException; import java.util.Objects; diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java index 0554dd283c..0a4c2dceb1 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/SolveResult.java @@ -4,16 +4,16 @@ */ package com.nvidia.cuopt.spi; -import com.nvidia.cuopt.linear_programming.ErrorStatus; -import com.nvidia.cuopt.linear_programming.LpStats; -import com.nvidia.cuopt.linear_programming.MIPStats; -import com.nvidia.cuopt.linear_programming.SolverMethod; -import com.nvidia.cuopt.linear_programming.TerminationStatus; +import com.nvidia.cuopt.optimization.ErrorStatus; +import com.nvidia.cuopt.optimization.LpStats; +import com.nvidia.cuopt.optimization.MIPStats; +import com.nvidia.cuopt.optimization.SolverMethod; +import com.nvidia.cuopt.optimization.TerminationStatus; /** * Internal data carrier from the FFM implementation back to the - * {@link com.nvidia.cuopt.linear_programming.Problem} or - * {@link com.nvidia.cuopt.linear_programming.Problem} that requested + * {@link com.nvidia.cuopt.optimization.Problem} or + * {@link com.nvidia.cuopt.optimization.Problem} that requested * the solve. Pre-extracted from the native {@code cuOptSolution} * handle before that handle is freed. * diff --git a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/cuOptProvider.java b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/cuOptProvider.java index c879da3186..70153e4dbf 100644 --- a/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/cuOptProvider.java +++ b/java/cuopt-java/src/main/java/com/nvidia/cuopt/spi/cuOptProvider.java @@ -5,8 +5,8 @@ package com.nvidia.cuopt.spi; import com.nvidia.cuopt.cuOptException; -import com.nvidia.cuopt.linear_programming.Problem; -import com.nvidia.cuopt.linear_programming.SolverSettings; +import com.nvidia.cuopt.optimization.Problem; +import com.nvidia.cuopt.optimization.SolverSettings; import java.util.ServiceLoader; /** diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CSRBuilder.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CSRBuilder.java index 8e52a636a0..88b1b6bccd 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CSRBuilder.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/CSRBuilder.java @@ -4,9 +4,9 @@ */ package com.nvidia.cuopt.internal; -import com.nvidia.cuopt.linear_programming.LinearExpr; -import com.nvidia.cuopt.linear_programming.QuadraticExpr; -import com.nvidia.cuopt.linear_programming.Variable; +import com.nvidia.cuopt.optimization.LinearExpr; +import com.nvidia.cuopt.optimization.QuadraticExpr; +import com.nvidia.cuopt.optimization.Variable; import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/cuOptProviderImpl.java b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/cuOptProviderImpl.java index 9bac70f903..bd484c56cb 100644 --- a/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/cuOptProviderImpl.java +++ b/java/cuopt-java/src/main/java22/com/nvidia/cuopt/internal/cuOptProviderImpl.java @@ -8,21 +8,21 @@ import com.nvidia.cuopt.internal.panama.cuOptMIPGetSolutionCallback; import com.nvidia.cuopt.internal.panama.cuOptMIPSetSolutionCallback; import com.nvidia.cuopt.internal.panama.cuopt_c_h; -import com.nvidia.cuopt.linear_programming.CType; -import com.nvidia.cuopt.linear_programming.Constraint; -import com.nvidia.cuopt.linear_programming.ErrorStatus; -import com.nvidia.cuopt.linear_programming.LinearExpr; -import com.nvidia.cuopt.linear_programming.LpStats; -import com.nvidia.cuopt.linear_programming.MIPGetSolutionCallback; -import com.nvidia.cuopt.linear_programming.MIPSetSolutionCallback; -import com.nvidia.cuopt.linear_programming.MIPStats; -import com.nvidia.cuopt.linear_programming.Problem; -import com.nvidia.cuopt.linear_programming.QuadraticExpr; -import com.nvidia.cuopt.linear_programming.SolverMethod; -import com.nvidia.cuopt.linear_programming.SolverSettings; -import com.nvidia.cuopt.linear_programming.TerminationStatus; -import com.nvidia.cuopt.linear_programming.VType; -import com.nvidia.cuopt.linear_programming.Variable; +import com.nvidia.cuopt.optimization.CType; +import com.nvidia.cuopt.optimization.Constraint; +import com.nvidia.cuopt.optimization.ErrorStatus; +import com.nvidia.cuopt.optimization.LinearExpr; +import com.nvidia.cuopt.optimization.LpStats; +import com.nvidia.cuopt.optimization.MIPGetSolutionCallback; +import com.nvidia.cuopt.optimization.MIPSetSolutionCallback; +import com.nvidia.cuopt.optimization.MIPStats; +import com.nvidia.cuopt.optimization.Problem; +import com.nvidia.cuopt.optimization.QuadraticExpr; +import com.nvidia.cuopt.optimization.SolverMethod; +import com.nvidia.cuopt.optimization.SolverSettings; +import com.nvidia.cuopt.optimization.TerminationStatus; +import com.nvidia.cuopt.optimization.VType; +import com.nvidia.cuopt.optimization.Variable; import com.nvidia.cuopt.spi.cuOptProvider; import com.nvidia.cuopt.spi.SolveResult; import java.lang.foreign.Arena; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/LinearExprTest.java similarity index 97% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/LinearExprTest.java index 06ce518c24..f57dac19c1 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LinearExprTest.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/LinearExprTest.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/LpSolverIT.java similarity index 98% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/LpSolverIT.java index d4504bb327..29bdedb61c 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/LpSolverIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/LpSolverIT.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/MIPCallbackIT.java similarity index 98% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/MIPCallbackIT.java index 1639daf724..4f749cc11a 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MipCallbackIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/MIPCallbackIT.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -13,7 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.junit.jupiter.api.Test; -class MipCallbackIT { +class MIPCallbackIT { /** Captures one incumbent delivered by the solver. */ private record Incumbent(double[] solution, double objective, double bound) {} diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/MilpSolverIT.java similarity index 97% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/MilpSolverIT.java index 4e9dca7d2a..377b3db452 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/MilpSolverIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/MilpSolverIT.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/QpSolverIT.java similarity index 97% rename from java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java rename to java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/QpSolverIT.java index 67931f4234..703c637f4d 100644 --- a/java/cuopt-java/src/test/java/com/nvidia/cuopt/linear_programming/QpSolverIT.java +++ b/java/cuopt-java/src/test/java/com/nvidia/cuopt/optimization/QpSolverIT.java @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ -package com.nvidia.cuopt.linear_programming; +package com.nvidia.cuopt.optimization; import static com.nvidia.cuopt.cuOpt.*; import static org.junit.jupiter.api.Assertions.assertEquals; From 49f2ab9743ee52b14615a95e910d09a0d745f1e0 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 14 May 2026 15:01:08 -0500 Subject: [PATCH 27/28] java/ci: always build the classifier JAR in CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors cuvs's behavior: every CI run produces both the base JAR (BYO libcuopt) and the per-(arch, cuda) classifier JAR that bundles libcuopt + libmps_parser + librmm + librapids_logger and carries the Embedded-Libraries-Cuda-Version manifest entry. Wires CLASSIFIER_CUDA=${RAPIDS_CUDA_VERSION%%.*} into ci/build_java.sh so the existing classifier-jar Maven profile activates in CI. Locally verified earlier in the PR session (CLASSIFIER_CUDA=13 ./java/build.sh produces a 56 MB classifier JAR; embedded mode loads libcuopt without LD_LIBRARY_PATH). Each CI matrix entry now produces two JARs uploaded under cuopt-java-cuda / cuopt-java-arm64-cuda artifacts; with the two arch × two CUDA-major matrix rows, that's four classifier JARs per push ready for Maven Central. --- ci/build_java.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ci/build_java.sh b/ci/build_java.sh index 7ac12a9299..394078f3f3 100755 --- a/ci/build_java.sh +++ b/ci/build_java.sh @@ -61,6 +61,13 @@ rapids-logger "Build cuopt-java (run_tests=${RUN_JAVA_TESTS})" export CUOPT_INCLUDE="${CONDA_PREFIX}/include" export CMAKE_PREFIX_PATH="${CONDA_PREFIX}/lib" +# Produce the per-(arch, cuda) classifier JAR alongside the base JAR +# on every CI run. The classifier JAR bundles libcuopt.so + libmps_parser.so +# + librmm.so + librapids_logger.so and carries the manifest entry +# Embedded-Libraries-Cuda-Version. Matches cuvs's java/build.sh behavior +# of always activating the build profile (cuvs sets -P $arch-cuda$major). +export CLASSIFIER_CUDA="${RAPIDS_CUDA_VERSION%%.*}" + # jextract is auto-downloaded by panama-bindings/generate-bindings.sh on # first run (cuvs pattern). No CI image change required. # From cca5db7de86b2b1b891736492b60a505154cc0be Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 14 May 2026 16:30:19 -0500 Subject: [PATCH 28/28] java/ci: include libcuopt + libmps_parser in classifier JAR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous CI commit (49f2ab97) wired CLASSIFIER_CUDA so the classifier-jar Maven profile fires, but the produced JAR contained only librmm.so + librapids_logger.so. libcuopt.so + libmps_parser.so were missing because the pom's `copy-cuopt-libs` execution reads from ${native.cpp.build.path} (default: ${project.basedir}/../../cpp/build), which does not exist in CI — libcuopt lives at $CONDA_PREFIX/lib in the CI env after the upstream conda-cpp-build artifact is unpacked. Two-part fix: pom.xml — the flat-layout resource entry now includes libmps_parser.so alongside libcuopt.so. The cpp/build nested fallback (libmps_parser/libmps_parser.so) is kept so local dev builds against a populated cpp/build tree continue to work. Maven's resource plugin warns and skips non-existent entries, so listing both layouts is safe. ci/build_java.sh + java/build.sh — when CLASSIFIER_CUDA is set, build.sh now also honors a NATIVE_CPP_BUILD_PATH env var and passes it through as -Dnative.cpp.build.path=... Defaults (unset) keep the existing local-dev cpp/build behavior. CI sets NATIVE_CPP_BUILD_PATH=$CONDA_PREFIX/lib. Verified locally both ways: the produced classifier JAR contains libcuopt.so (74 MB), libmps_parser.so, librmm.so, and librapids_logger.so in both modes. --- ci/build_java.sh | 5 +++++ java/build.sh | 8 ++++++++ java/cuopt-java/pom.xml | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/ci/build_java.sh b/ci/build_java.sh index 394078f3f3..92acaa376a 100755 --- a/ci/build_java.sh +++ b/ci/build_java.sh @@ -68,6 +68,11 @@ export CMAKE_PREFIX_PATH="${CONDA_PREFIX}/lib" # of always activating the build profile (cuvs sets -P $arch-cuda$major). export CLASSIFIER_CUDA="${RAPIDS_CUDA_VERSION%%.*}" +# In CI there is no local cpp/build directory; libcuopt.so + libmps_parser.so +# come from the conda env populated by rapids-download-conda-from-github. +# Tell the maven classifier-jar profile to pull them from $CONDA_PREFIX/lib. +export NATIVE_CPP_BUILD_PATH="${CONDA_PREFIX}/lib" + # jextract is auto-downloaded by panama-bindings/generate-bindings.sh on # first run (cuvs pattern). No CI image change required. # diff --git a/java/build.sh b/java/build.sh index acfdd846ae..e4b9ecbcb3 100755 --- a/java/build.sh +++ b/java/build.sh @@ -132,6 +132,14 @@ if [[ -n "${CLASSIFIER_CUDA:-}" ]]; then fi MVN_ARGS+=("-Dcuda.version=${CLASSIFIER_CUDA}") echo " Building classifier JAR for cuda${CLASSIFIER_CUDA} (RAPIDS libs from ${CONDA_PREFIX}/lib)" + + # CI sets NATIVE_CPP_BUILD_PATH because there's no local cpp/build; libcuopt.so + # and libmps_parser.so live at $CONDA_PREFIX/lib alongside librmm/rapids_logger. + # For local dev with a populated cpp/build/, leave it unset to use the pom default. + if [[ -n "${NATIVE_CPP_BUILD_PATH:-}" ]]; then + MVN_ARGS+=("-Dnative.cpp.build.path=${NATIVE_CPP_BUILD_PATH}") + echo " libcuopt + libmps_parser sourced from ${NATIVE_CPP_BUILD_PATH}" + fi fi if [[ "${SKIP_TESTS:-false}" == "true" ]]; then diff --git a/java/cuopt-java/pom.xml b/java/cuopt-java/pom.xml index 6ea05a3005..22051de850 100644 --- a/java/cuopt-java/pom.xml +++ b/java/cuopt-java/pom.xml @@ -246,11 +246,18 @@ true ${project.build.directory}/native-libs/${os.arch}/${os.name} + ${native.cpp.build.path} libcuopt.so + libmps_parser.so