[RFC]: add `ndarray/tensor3d/ctor`
@0PrashantYadav0 đang làm issue này rồi.
Từ ngày 4/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Description
This RFC proposes adding @stdlib/ndarray/tensor3d/ctor, the three-dimensional counterpart to the existing @stdlib/ndarray/vector/ctor and @stdlib/ndarray/matrix/ctor packages, as the next step toward providing dedicated dimensional constructors up to five dimensions.
Motivation
As with ndarray/vector/* and ndarray/matrix/*, these APIs provide convenient dedicated interfaces for constructing arrays of a known dimensionality from nested arrays, together with the corresponding validation. For example,
var x = new Float64Tensor3D( [ [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], [ [ 7, 8, 9 ], [ 10, 11, 12 ] ] ] );
// returns <ndarray>
Dimensional constructors up to 5D cover more than 80% of end-user use cases for ndarray dimensionality. Arrays of six or more dimensions are markedly less common and are adequately served by the general-purpose @stdlib/ndarray/ctor and @stdlib/ndarray/array APIs.
Supported options (readonly, mode, submode, order) and their defaults are unchanged from matrix/ctor.
Future plan
This RFC covers tensor3d/ctor and the typed constructors. The sequence:
- The parent
@stdlib/ndarray/tensor3dnamespace package — handled separately by a maintainer. Not done here. - Typed 3D constructors — done. The complete set matching
vector:bool(BooleanTensor3D),complex64,complex128,float32,float64,int8,int16,int32,uint8,uint8c(Uint8ClampedTensor3D),uint16,uint32. Each is a thin wrapper overrequire( '@stdlib/ndarray/tensor3d/ctor' ).factory( dtype )accompanied by documentation, types, tests, and benchmarks. ndarray/tensor4d— constructor plus typed packages, using@stdlib/array/base/flatten4d.ndarray/tensor5d— constructor plus typed packages, using@stdlib/array/base/flatten5d, completing coverage through five dimensions.
Constructor names follow the vector convention rather than a literal data type transliteration: bool exports BooleanTensor3D and uint8c exports Uint8ClampedTensor3D. Package descriptions use the repository's dominant phrasing for integer types ("signed 32-bit integer", used by 39 packages) rather than the inverted form used by matrix/int32 and two others.
Related Issues
None.
Questions
No.
Three questions were raised while drafting and have since been resolved by a maintainer:
- Should the thin parent
@stdlib/ndarray/tensor3dnamespace package land together withtensor3d/ctor? — No. It will be handled separately by a maintainer. - Should the typed constructors mirror the
matrixset or the broadervectorset? — The full set, matchingvector. Work is already in progress to bring thematrixnamespace up to the complete set. - Should the
from_arraybuffer.jsTODObe tackled as part of this work? — No. Work on@stdlib/ndarray/from-arraybufferis already in progress separately; copying the helper is acceptable for now.
Other
No.
Checklist
- I have read and understood the Code of Conduct.
- Searched for existing issues and pull requests.
- The issue name begins with
RFC:.
- Ngôn ngữ chính
- JavaScript
- Star
- 6k
- Fork
- 1.3k
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 559
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của stdlib-js/stdlib
-
Fix JavaScript lint errors Đang mởGood First Issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
Fix JavaScript lint errors Đang mởGood First Issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Fix JavaScript lint errors Đang mởGood First Issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Fix JavaScript lint errors Đang mởGood First Issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Tất cả issue của stdlib-js/stdlib
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
apache/cloudstack#14222 ·
-
Browser Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
getsentry/sentry-javascript#24577 · 1 bình luận ·
-
curation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
amponce/archive-movie-browser#186 ·
-
light
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
aemdemos/patients-stryker#253 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
clerk/javascript#9852 ·