Skip to content

Add NdArray Mean function#15

Merged
Oceania2018 merged 1 commit into
SciSharp:masterfrom
PppBr:master
Oct 18, 2018
Merged

Add NdArray Mean function#15
Oceania2018 merged 1 commit into
SciSharp:masterfrom
PppBr:master

Conversation

@PppBr

@PppBr PppBr commented Oct 18, 2018

Copy link
Copy Markdown
Member

No description provided.

@Oceania2018

Copy link
Copy Markdown
Member

Thanks for contributing this function.

@Oceania2018 Oceania2018 merged commit b3ad742 into SciSharp:master Oct 18, 2018
Nucs added a commit that referenced this pull request Jun 6, 2026
…cs (Phase 1 F3a)

NumSharp promoted every integer input to float64 for the float-producing unary
ufuncs (sqrt/cbrt/exp/log/trig/...), regardless of input width. NumPy NEP50 uses
WIDTH-BASED promotion: bool/int8/uint8 -> float16, int16/uint16 -> float32,
int32/uint32/int64/uint64 -> float64 (float/complex preserved). FUZZ_FINDINGS #7.

Fix: new DefaultEngine.ResolveUnaryFloatReturnType implements the width-based rule;
the 20 transcendental Default.<Op>.cs files (ACos/ASin/ATan/Cbrt/Cos/Cosh/Deg2Rad/
Exp/Exp2/Expm1/Log/Log10/Log1p/Log2/Rad2Deg/Sin/Sinh/Sqrt/Tan/Tanh) now call it
instead of ResolveUnaryReturnType (which widened to float64 via GetComputingType).
The int->Half / int->Single unary kernels already existed, so this is a pure
result-dtype routing change; int32/int64 are unaffected (already float64).

The dtype-PRESERVING ufuncs (square/floor/ceil/trunc/round/reciprocal) are
intentionally left on the old resolver pending F3b (they need integer identity /
x*x / int-reciprocal kernels to preserve the integer dtype).

Verification:
  * 364 of 494 unary dtype divergences clear bit-exact; the remaining 130 are the
    F3b-pending preserve-dtype ops, now scoped in MisalignedRegistry so a
    transcendental promotion regression fails the gate (not silently excused).
  * Half/Single transcendental values stay within 2 ULP of NumPy's float16/float32
    libm (documented algorithm difference, same class as complex-divide ULP).
  * DtypeCoverageTests.Sqrt_IntegerDtypes updated: it asserted the old uniform
    float64 (codified the bug); now asserts the NumPy width-based dtype per input.
  * Full net10.0 suite green: 9422 passed / 0 failed; FuzzMatrix 17/17.

Clears the transcendental half of FUZZ_FINDINGS #7 (and #15 dtype for those ops).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants