pgcuts.hyp2f1

GPU-accelerated Gauss hypergeometric function \({}_{2}F_{1}(-m, b; c; z)\) specialized for non-positive integer \(a = -m\) with \(z \in [0, 1]\).

class pgcuts.hyp2f1.Hyp2F1(*args, **kwargs)[source]

Differentiable 2F1(-m, b; c; z) with backward.

Uses Triton backend by default (portable).

Usage:

result = Hyp2F1.apply(a, b, c, z)
result.sum().backward()   # computes z.grad
static forward(ctx, a, b, c, z)[source]

Compute 2F1(a, b; c; z) forward pass.

static backward(ctx, grad_output)[source]

Compute gradient w.r.t. z.

Usage:

from pgcuts.hyp2f1 import Hyp2F1

# Forward: compute 2F1(-512, 1, 2, z) on GPU
result = Hyp2F1.apply(-512, 1.0, 2.0, z)

# Backward: gradient w.r.t. z via derivative identity
result.sum().backward()  # computes z.grad

The backend (Triton or CUDA) is selected automatically. Set HYP2F1_BACKEND=cuda to force the CUDA backend.