Skip to content

Commit e36ef95

Browse files
committed
docs: rename page to 'NumPy Compliance & Compatibility'
1 parent 8779808 commit e36ef95

7 files changed

Lines changed: 106 additions & 106 deletions

File tree

docs/website-src/docs/compliance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Compliance and Compatibility
1+
# NumPy Compliance & Compatibility
22

33
NumSharp aims for **1-to-1 behavioral compatibility with NumPy 2.x** and compliance with the **Python Array API Standard**. This page tracks our progress toward these goals.
44

docs/website-src/docs/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
href: NDArray.Creation.md
55
- name: Linear Algebra
66
href: NDArray.LinAlg.md
7-
- name: Compliance & Compatibility
7+
- name: NumPy Compliance & Compatibility
88
href: compliance.md
99

1010

docs/website/docs/compliance.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>Compliance and Compatibility | NumSharp Documentation </title>
5+
<title>NumPy Compliance &amp; Compatibility | NumSharp Documentation </title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<meta name="title" content="Compliance and Compatibility | NumSharp Documentation ">
7+
<meta name="title" content="NumPy Compliance &amp; Compatibility | NumSharp Documentation ">
88

99

1010
<link rel="icon" href="../images/numsharp.icon128.png">
@@ -85,7 +85,7 @@ <h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
8585
</div>
8686

8787
<article data-uid="">
88-
<h1 id="compliance-and-compatibility">Compliance and Compatibility</h1>
88+
<h1 id="numpy-compliance--compatibility">NumPy Compliance &amp; Compatibility</h1>
8989

9090
<p>NumSharp aims for <strong>1-to-1 behavioral compatibility with NumPy 2.x</strong> and compliance with the <strong>Python Array API Standard</strong>. This page tracks our progress toward these goals.</p>
9191
<hr>

docs/website/docs/toc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<a href="NDArray.LinAlg.html" name="" title="Linear Algebra">Linear Algebra</a>
2323
</li>
2424
<li>
25-
<a href="compliance.html" name="" title="Compliance &amp; Compatibility">Compliance &amp; Compatibility</a>
25+
<a href="compliance.html" name="" title="NumPy Compliance &amp; Compatibility">NumPy Compliance &amp; Compatibility</a>
2626
</li>
2727
</ul>
2828
</div>

docs/website/docs/toc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
{"items":[{"name":"Introduction","href":"intro.html","topicHref":"intro.html"},{"name":"Array Creation","href":"NDArray.Creation.html","topicHref":"NDArray.Creation.html"},{"name":"Linear Algebra","href":"NDArray.LinAlg.html","topicHref":"NDArray.LinAlg.html"},{"name":"Compliance & Compatibility","href":"compliance.html","topicHref":"compliance.html"}]}
2+
{"items":[{"name":"Introduction","href":"intro.html","topicHref":"intro.html"},{"name":"Array Creation","href":"NDArray.Creation.html","topicHref":"NDArray.Creation.html"},{"name":"Linear Algebra","href":"NDArray.LinAlg.html","topicHref":"NDArray.LinAlg.html"},{"name":"NumPy Compliance & Compatibility","href":"compliance.html","topicHref":"compliance.html"}]}

docs/website/index.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@
471471
},
472472
"docs/compliance.html": {
473473
"href": "docs/compliance.html",
474-
"title": "Compliance and Compatibility | NumSharp Documentation",
475-
"summary": "Compliance and Compatibility NumSharp aims for 1-to-1 behavioral compatibility with NumPy 2.x and compliance with the Python Array API Standard. This page tracks our progress toward these goals. Compliance Goals Standard Target Status Milestone NumPy 2.x 2.4.2+ In Progress NumPy 2.x Compliance Array API Standard 2024.12 In Progress Array API Standard NumPy Enhancement Proposals Key NEPs In Progress NEP Compliance NumPy 2.x Compliance NumPy 2.0 introduced significant breaking changes. NumSharp is working to align with these changes. Type Promotion (NEP 50) NumPy 2.x changed from value-based to weak scalar promotion: // NumPy 1.x behavior (OLD - value-based) np.result_type(np.int8, 1) == np.int8 // 1 fits in int8 np.result_type(np.int8, 255) == np.int16 // 255 doesn't fit - UPCASTED // NumPy 2.x behavior (NEW - weak scalar) uint8(1) + 2 → uint8(3) // Python scalar defers to array dtype uint8(1) + 255 → uint8(0) // Overflow with warning NumSharp Status: #529 - Type promotion diverges from NEP 50 API Cleanup (NEP 52) NumPy 2.0 removed ~100 deprecated functions and aliases: Removed Use Instead np.round_ np.round np.product np.prod np.sometrue np.any np.alltrue np.all Array API Standard Functions (NEP 56) New functions and aliases added in NumPy 2.x: Category Functions Aliases acos, asin, atan, atan2, concat, permute_dims, pow New isdtype(), unique_values(), unique_counts(), unique_inverse(), unique_all() Properties ndarray.mT (matrix transpose), ndarray.device copy= Semantics np.asarray(x, copy: true) // Always copy np.asarray(x, copy: false) // Never copy (raise if needed) np.asarray(x, copy: null) // Copy if necessary (default) Array API Standard Compliance The Python Array API Standard defines a common API for array computing libraries, enabling code portability across NumPy, PyTorch, JAX, CuPy, and Dask. Data Types Category Required NumSharp Boolean bool ✅ Signed Integer int8, int16, int32, int64 ✅ (as short, int, long) Unsigned Integer uint8, uint16, uint32, uint64 ✅ Floating-Point float32, float64 ✅ Complex complex64, complex128 ❌ Not implemented Gap: Complex number support is not yet implemented. Required Constants Constant Description NumSharp e Euler's constant ✅ inf Positive infinity ✅ nan Not a Number ✅ newaxis Dimension expansion ✅ pi Mathematical pi ✅ Array Attributes Attribute Description NumSharp dtype Data type ✅ device Hardware device ❌ ndim Number of dimensions ✅ shape Dimensions ✅ size Total element count ✅ T Transpose ✅ mT Matrix transpose ❌ Function Coverage Category Required NumSharp Coverage Creation 16 ~14 87% Element-wise 67 ~50 75% Data Types 6 ~3 50% Linear Algebra 4 4 100% Manipulation 14 ~10 71% Statistical 9 ~7 78% Searching 6 ~4 67% Sorting 2 2 100% Set 4 1 25% Indexing 2 0 0% Utility 3 2 67% Total Core 133 ~80 ~60% Optional Extensions Extension Functions NumSharp Status linalg 23 (cholesky, det, eigh, inv, qr, svd, solve...) Partial (most are stubs) fft 14 (fft, ifft, rfft, fftfreq...) Not implemented See #560 for full specification details. NEP Compliance NumPy Enhancement Proposals (NEPs) define behavioral standards. Key NEPs for NumSharp: Critical - NumPy 2.0 Breaking Changes NEP Title Status Issue NEP 50 Promotion Rules for Python Scalars In Progress #547 NEP 52 Python API Cleanup In Progress #547 NEP 56 Array API Standard Support In Progress #547 High Priority - Feature Completeness NEP Title Status Issue NEP 07 DateTime and Timedelta Types Not Started #554 NEP 19 Random Number Generator Policy Implemented #553 NEP 27 Zero Rank Arrays (Scalars) Partial #550 NEP 55 UTF-8 Variable-Width String DType Not Started #549 Medium Priority - Behavioral Considerations NEP Title Status Issue NEP 05 Generalized Universal Functions Partial #551 NEP 21 Advanced Indexing Semantics In Progress #552 NEP 42 New and Extensible DTypes Not Started #549 Performance - SIMD Optimization NEP Title Status Issue NEP 10 Iterator/UFunc Optimization Not Started #548 NEP 38 SIMD Optimization Instructions Not Started #548 NEP 54 SIMD Infrastructure (Highway) Not Started #548 Supported Data Types NumSharp currently supports 12 numeric data types: NPTypeCode C# Type NumPy Equivalent Array API Boolean bool np.bool_ ✅ Byte byte np.uint8 ✅ Int16 short np.int16 ✅ UInt16 ushort np.uint16 ✅ Int32 int np.int32 ✅ UInt32 uint np.uint32 ✅ Int64 long np.int64 ✅ UInt64 ulong np.uint64 ✅ Char char (no equivalent) ❌ Single float np.float32 ✅ Double double np.float64 ✅ Decimal decimal (no equivalent) ❌ Missing Types Type Status Priority complex64 Not implemented High (Array API required) complex128 Not implemented High (Array API required) datetime64 Not implemented Medium (NEP 07) timedelta64 Not implemented Medium (NEP 07) StringDType Not implemented Low (NEP 55) Memory Layout Feature NumPy NumSharp C-order (row-major) ✅ ✅ F-order (column-major) ✅ ❌ Note: NumSharp only supports C-order (row-major) memory layout. The order parameter on ravel, flatten, copy, and reshape is accepted but ignored. See #546 for F-order support tracking. File Format Interoperability Format Read Write Notes .npy ✅ ✅ NumPy array format (NEP 01) .npz ✅ ❌ Compressed archive of .npy files Binary ✅ ✅ fromfile() / tofile() Files created by NumSharp can be read by NumPy and vice versa. Random Number Generation NumSharp's np.random module provides 1-to-1 seed matching with NumPy (NEP 19): // Same seed produces identical sequences np.random.seed(42); var a = np.random.rand(5); // Equivalent Python: // np.random.seed(42) // a = np.random.rand(5) This enables reproducible results when porting code between NumPy and NumSharp. Implementation Roadmap Phase 1: Core Compatibility (Current) Fix type promotion to match NEP 50 API cleanup audit (NEP 52) Add Array API functions and aliases (NEP 56) Phase 2: Feature Completeness Add complex number support (complex64, complex128) Add datetime64 / timedelta64 types (NEP 07) Implement missing Array API functions Phase 3: Extensions Complete linalg extension (currently stubs) Add fft extension Phase 4: Performance SIMD optimization (NEP 38/54) Iterator optimization (NEP 10) Contributing Help us achieve NumPy compatibility! See our GitHub milestones for tracked issues: NumPy 2.x Compliance Array API Standard Compliance NEP Compliance References NumPy 2.0 Migration Guide Python Array API Standard NumPy Enhancement Proposals NumPy Source (v2.4.2) - Reference implementation at src/numpy/"
474+
"title": "NumPy Compliance & Compatibility | NumSharp Documentation",
475+
"summary": "NumPy Compliance & Compatibility NumSharp aims for 1-to-1 behavioral compatibility with NumPy 2.x and compliance with the Python Array API Standard. This page tracks our progress toward these goals. Compliance Goals Standard Target Status Milestone NumPy 2.x 2.4.2+ In Progress NumPy 2.x Compliance Array API Standard 2024.12 In Progress Array API Standard NumPy Enhancement Proposals Key NEPs In Progress NEP Compliance NumPy 2.x Compliance NumPy 2.0 introduced significant breaking changes. NumSharp is working to align with these changes. Type Promotion (NEP 50) NumPy 2.x changed from value-based to weak scalar promotion: // NumPy 1.x behavior (OLD - value-based) np.result_type(np.int8, 1) == np.int8 // 1 fits in int8 np.result_type(np.int8, 255) == np.int16 // 255 doesn't fit - UPCASTED // NumPy 2.x behavior (NEW - weak scalar) uint8(1) + 2 → uint8(3) // Python scalar defers to array dtype uint8(1) + 255 → uint8(0) // Overflow with warning NumSharp Status: #529 - Type promotion diverges from NEP 50 API Cleanup (NEP 52) NumPy 2.0 removed ~100 deprecated functions and aliases: Removed Use Instead np.round_ np.round np.product np.prod np.sometrue np.any np.alltrue np.all Array API Standard Functions (NEP 56) New functions and aliases added in NumPy 2.x: Category Functions Aliases acos, asin, atan, atan2, concat, permute_dims, pow New isdtype(), unique_values(), unique_counts(), unique_inverse(), unique_all() Properties ndarray.mT (matrix transpose), ndarray.device copy= Semantics np.asarray(x, copy: true) // Always copy np.asarray(x, copy: false) // Never copy (raise if needed) np.asarray(x, copy: null) // Copy if necessary (default) Array API Standard Compliance The Python Array API Standard defines a common API for array computing libraries, enabling code portability across NumPy, PyTorch, JAX, CuPy, and Dask. Data Types Category Required NumSharp Boolean bool ✅ Signed Integer int8, int16, int32, int64 ✅ (as short, int, long) Unsigned Integer uint8, uint16, uint32, uint64 ✅ Floating-Point float32, float64 ✅ Complex complex64, complex128 ❌ Not implemented Gap: Complex number support is not yet implemented. Required Constants Constant Description NumSharp e Euler's constant ✅ inf Positive infinity ✅ nan Not a Number ✅ newaxis Dimension expansion ✅ pi Mathematical pi ✅ Array Attributes Attribute Description NumSharp dtype Data type ✅ device Hardware device ❌ ndim Number of dimensions ✅ shape Dimensions ✅ size Total element count ✅ T Transpose ✅ mT Matrix transpose ❌ Function Coverage Category Required NumSharp Coverage Creation 16 ~14 87% Element-wise 67 ~50 75% Data Types 6 ~3 50% Linear Algebra 4 4 100% Manipulation 14 ~10 71% Statistical 9 ~7 78% Searching 6 ~4 67% Sorting 2 2 100% Set 4 1 25% Indexing 2 0 0% Utility 3 2 67% Total Core 133 ~80 ~60% Optional Extensions Extension Functions NumSharp Status linalg 23 (cholesky, det, eigh, inv, qr, svd, solve...) Partial (most are stubs) fft 14 (fft, ifft, rfft, fftfreq...) Not implemented See #560 for full specification details. NEP Compliance NumPy Enhancement Proposals (NEPs) define behavioral standards. Key NEPs for NumSharp: Critical - NumPy 2.0 Breaking Changes NEP Title Status Issue NEP 50 Promotion Rules for Python Scalars In Progress #547 NEP 52 Python API Cleanup In Progress #547 NEP 56 Array API Standard Support In Progress #547 High Priority - Feature Completeness NEP Title Status Issue NEP 07 DateTime and Timedelta Types Not Started #554 NEP 19 Random Number Generator Policy Implemented #553 NEP 27 Zero Rank Arrays (Scalars) Partial #550 NEP 55 UTF-8 Variable-Width String DType Not Started #549 Medium Priority - Behavioral Considerations NEP Title Status Issue NEP 05 Generalized Universal Functions Partial #551 NEP 21 Advanced Indexing Semantics In Progress #552 NEP 42 New and Extensible DTypes Not Started #549 Performance - SIMD Optimization NEP Title Status Issue NEP 10 Iterator/UFunc Optimization Not Started #548 NEP 38 SIMD Optimization Instructions Not Started #548 NEP 54 SIMD Infrastructure (Highway) Not Started #548 Supported Data Types NumSharp currently supports 12 numeric data types: NPTypeCode C# Type NumPy Equivalent Array API Boolean bool np.bool_ ✅ Byte byte np.uint8 ✅ Int16 short np.int16 ✅ UInt16 ushort np.uint16 ✅ Int32 int np.int32 ✅ UInt32 uint np.uint32 ✅ Int64 long np.int64 ✅ UInt64 ulong np.uint64 ✅ Char char (no equivalent) ❌ Single float np.float32 ✅ Double double np.float64 ✅ Decimal decimal (no equivalent) ❌ Missing Types Type Status Priority complex64 Not implemented High (Array API required) complex128 Not implemented High (Array API required) datetime64 Not implemented Medium (NEP 07) timedelta64 Not implemented Medium (NEP 07) StringDType Not implemented Low (NEP 55) Memory Layout Feature NumPy NumSharp C-order (row-major) ✅ ✅ F-order (column-major) ✅ ❌ Note: NumSharp only supports C-order (row-major) memory layout. The order parameter on ravel, flatten, copy, and reshape is accepted but ignored. See #546 for F-order support tracking. File Format Interoperability Format Read Write Notes .npy ✅ ✅ NumPy array format (NEP 01) .npz ✅ ❌ Compressed archive of .npy files Binary ✅ ✅ fromfile() / tofile() Files created by NumSharp can be read by NumPy and vice versa. Random Number Generation NumSharp's np.random module provides 1-to-1 seed matching with NumPy (NEP 19): // Same seed produces identical sequences np.random.seed(42); var a = np.random.rand(5); // Equivalent Python: // np.random.seed(42) // a = np.random.rand(5) This enables reproducible results when porting code between NumPy and NumSharp. Implementation Roadmap Phase 1: Core Compatibility (Current) Fix type promotion to match NEP 50 API cleanup audit (NEP 52) Add Array API functions and aliases (NEP 56) Phase 2: Feature Completeness Add complex number support (complex64, complex128) Add datetime64 / timedelta64 types (NEP 07) Implement missing Array API functions Phase 3: Extensions Complete linalg extension (currently stubs) Add fft extension Phase 4: Performance SIMD optimization (NEP 38/54) Iterator optimization (NEP 10) Contributing Help us achieve NumPy compatibility! See our GitHub milestones for tracked issues: NumPy 2.x Compliance Array API Standard Compliance NEP Compliance References NumPy 2.0 Migration Guide Python Array API Standard NumPy Enhancement Proposals NumPy Source (v2.4.2) - Reference implementation at src/numpy/"
476476
},
477477
"docs/intro.html": {
478478
"href": "docs/intro.html",

0 commit comments

Comments
 (0)