cplx_cr_residual — MATH complex op

데이터 종류: cimagemeasurement

호출: import mathops; mathops.cplx_cr_residual(f, spacing=1.0)(또는 opsmath.get("cplx_cr_residual"))

사용법

표본화된 복소장의 코시-리만 잔차 —— 「이 장은 정칙인가?」를 하나의 수로.

> 아래 상세 설명은 원문입니다 —— 요약과 제목은 번역되어 있습니다.

With `f = u + i v` sampled on a uniform grid, holomorphy means

`u_x = v_y and u_y = -v_x` (Cauchy-Riemann). This returns the

relative residual `max(|u_x - v_y|, |u_y + v_x|) / max|grad|`

(central differences, `numpy.gradient): 0` = the samples satisfy CR to

the discretisation limit, `2` = the field is the conjugate of a

holomorphic one (`conj(z)` gives exactly 2), values in between = partly

analytic or noisy.

Grid convention (it decides the sign of the answer): `f[i, j]` is the

field at `z = x0 + j*spacing + i*spacing*1j` — rows index the *increasing

imaginary* axis, columns the real axis. Image arrays usually run rows

*downward*; feeding one directly measures the conjugate field, whose

residual is `2, not 0. Flip rows (f[::-1]`) to use image data.

Discretisation, honestly: central differences are exact for polynomials of

degree <= 2, so `f = z**2` returns exactly 0; for higher order the

residual floors at `O(h^2 * |f'''|) (measured: f = z**3` on a

`[-1,1]^2 grid returns 1.7e-3 at h` and 4.2e-4 at

`h/2` — a factor 4.00, the expected second order). Read a

small value as "consistent with holomorphic at this resolution", never as

proof.

A constant field returns `0.0 (it is holomorphic; the 0/0` of the

normalisation is resolved by that limit, and stated here rather than left

to numpy).

Raises `ValueError`: not a 2-D array, either dimension below 3 (no

central difference exists), non-finite/masked input, over-cap size,

non-finite or non-positive *spacing*.

HALCON: no operator (`derivate_gauss` supplies the real-valued

derivatives one would build this from).

패밀리 공통 입력 계약(fail-closed)

mathops 의 모든 연산자는 입력을 검증한 뒤에 계산합니다(조용히 통과시키지 않습니다):

• **complex 입력은 ValueError** —— float64 로의 강제 변환은 허수부를 조용히 버립니다(numpy 는 ComplexWarning 만 내고 「그럴듯하게 틀린」 실수를 돌려줍니다). .real/.imag/abs() 를 명시하거나 복소수를 다루는 complexops 를 쓰세요.

• **masked 요소가 있는 masked array 는 ValueError** —— 마스크를 벗겨 아래 원값을 쓰는 암묵 변환을 거부합니다. 채울지 버릴지를 명시하세요.

• **NaN/Inf 는 모든 입력에서 ValueError**(개수를 명시하고 거부 —— 결과 전체로 전파되므로).

형상은 엄격: 1-D 와 2-D 를 암묵적으로 승격·브로드캐스트하지 않습니다(vector 슬롯에 matrix, matrix 슬롯에 vector 는 ValueError. reshape 를 명시하세요).

크기 상한: 행렬을 받는 연산자와 stat_histogram 의 bins 는 mathops.MAX_ELEMENTS(2^26 ≈ 6700 만 요소)를 넘으면 ValueError.

자세한 사용 가이드

math_metrology 패밀리 가이드

참고(샘플 데이터·문헌)

• 샘플 데이터 카탈로그(DL URL / 라이선스) —— 2-D 는 skimage.data(BSD/public)+ 합성, 3-D 는 실데이터 소스(Stanford/PDS 등)의 DL URL.

• 연산자의 내력·참고문헌 —— 이 연산자 족의 바탕이 된 연구/기법의 출처.

• 알고리즘의 정전(저자·연도)과 용도는 위의 패밀리 사용 가이드에 적혀 있습니다.

실행 가능한 예제(이 연산자를 실제로 호출하는 검증된 샘플)

math_complexpy -3.11 examples/math_complex.py

타입이 이어지는 다음 연산자(measurement 를 입력으로 받는 것)

같은 카테고리(complex)

cplx_contour_circle · cplx_poly_eval · cplx_contour_integral · cplx_winding_number · cplx_cauchy_value · cplx_argument_principle · cplx_laurent_coeffs · cplx_joukowski


*Provenance: mathops.py — MATH 연산자 레지스트리. 이 op 노트는 tools/opdocs.py md 가 자동 생성합니다(직접 편집하지 마세요).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.