Skip to content

Commit 013db86

Browse files
committed
Auto-generated commit
1 parent 95a563a commit 013db86

File tree

18 files changed

+368
-52
lines changed

18 files changed

+368
-52
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@ jsconfig.json
188188
# Other editor files #
189189
######################
190190
.idea/
191-
192-
# Cursor #
193-
##########
191+
.cursor
194192
.cursorignore
193+
.windsurfrules
194+
.clinerules
195+
196+
# AI coding agents #
197+
####################
198+
CLAUDE.md
199+
GEMINI.md

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-05-26)
7+
## Unreleased (2025-09-19)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`1908bae`](https://github.com/stdlib-js/stdlib/commit/1908bae6fe4852798ed12f620b59af50f762f2e5) - add support for `struct` and `DataType` dtype values
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="issues">
1020

@@ -24,6 +34,7 @@ A total of 2 issues were closed in this release:
2434

2535
<details>
2636

37+
- [`1908bae`](https://github.com/stdlib-js/stdlib/commit/1908bae6fe4852798ed12f620b59af50f762f2e5) - **feat:** add support for `struct` and `DataType` dtype values _(by Athan Reines)_
2738
- [`a464a60`](https://github.com/stdlib-js/stdlib/commit/a464a60568b819f813aff054ba0c32476192d269) - **chore:** fix EditorConfig lint errors [(#6246)](https://github.com/stdlib-js/stdlib/pull/6246) _(by MANI, Athan Reines)_
2839
- [`b6a6575`](https://github.com/stdlib-js/stdlib/commit/b6a657548d4e7beacc37f26e7f49c77ae3ea2f0b) - **chore:** fix EditorConfig lint errors [(#6057)](https://github.com/stdlib-js/stdlib/pull/6057) _(by Kaushikgtm)_
2940
- [`2777e4b`](https://github.com/stdlib-js/stdlib/commit/2777e4be161869d09406e3b17947d24c64b47af2) - **bench:** resolve lint errors in benchmarks _(by Athan Reines)_

CONTRIBUTORS

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,49 @@ Abdelrahman Samir <60700731+abdelrahman04@users.noreply.github.com>
99
Abdul Kaium <97376242+impawstarlight@users.noreply.github.com>
1010
Abhay Punia <156515195+Hecker165@users.noreply.github.com>
1111
Abhijit Raut <abhijitmraut8010@gmail.com>
12+
Abhishek G <166795493+AbhishekG-Codes@users.noreply.github.com>
1213
Abhishek Jain <40913033+abhishekblue@users.noreply.github.com>
1314
Adarsh Palaskar <adarshpalaskar99@gmail.com>
1415
Aditya Sapra <adityaework@gmail.com>
16+
Aditya Singh <adityasinghk099@gmail.com>
1517
Ahmed Atwa <Ahmedatwa866@yahoo.com>
1618
Ahmed Kashkoush <ahmedkashkoush464@gmail.com>
1719
Ahmed Khaled <kahmd1444@gmail.com>
1820
Aksshay Balasubramanian <119944779+Aksshay88@users.noreply.github.com>
1921
Aleksandr <112382387+alextes90@users.noreply.github.com>
2022
Ali Salesi <ali_sal1381@yahoo.com>
21-
AlyAbdelmoneim <148393799+AlyAbdelmoneim@users.noreply.github.com>
23+
Aly Abdelmoneim <148393799+AlyAbdelmoneim@users.noreply.github.com>
2224
Aman Bhansali <bhansali.1@iitj.ac.in>
2325
AmanBhadkariya <140033975+AmanBhadkariya@users.noreply.github.com>
26+
Amisha Chhajed <136238836+amishhaa@users.noreply.github.com>
2427
Amit Jimiwal <amitjimiwal45@gmail.com>
28+
Anmol Sah <113588714+anmolsah@users.noreply.github.com>
29+
Annamalai Prabu <apfossdev@gmail.com>
2530
Anshu Kumar <132515490+anxhukumar@users.noreply.github.com>
2631
Anshu Kumar <contact.anshukumar@protonmail.com>
32+
Anshuman Singh <109489361+Anshumancanrock@users.noreply.github.com>
2733
Anudeep Sanapala <anudeep0306@gmail.com>
34+
Arihant Pal <arihant0pal@gmail.com>
35+
Aryan Bhirud <112156883+AryanBhirud@users.noreply.github.com>
36+
AryanJ18 <18aryanj2006@gmail.com>
2837
Athan Reines <kgryte@gmail.com>
38+
Atharva Patil <124063987+atharva-patil-23@users.noreply.github.com>
2939
Ayaka <73595362+USERSATOSHI@users.noreply.github.com>
3040
Bhavishy Agrawal <90029607+bhavishy2801@users.noreply.github.com>
3141
Brendan Graetz <bguiz@users.noreply.github.com>
3242
Bruno Fenzl <brunofenzl@gmail.com>
3343
Bryan Elee <rxbryn@gmail.com>
3444
Chinmay Joshi <86140365+JawHawk@users.noreply.github.com>
3545
Christopher Dambamuromo <chridam@gmail.com>
46+
DUDHAT HEMIL PRAVINKUMAR <138382078+Hemil36@users.noreply.github.com>
3647
Dan Rose <danoftheroses@gmail.com>
48+
Daniel Hernandez Gomez <156333015+dhernandeez13@users.noreply.github.com>
3749
Daniel Killenberger <daniel.killenberger@gmail.com>
3850
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
3951
Debashis Maharana <debashismaharana7854@gmail.com>
4052
Deep Trivedi <128926685+thedeeppp@users.noreply.github.com>
53+
Deepak Singh <78257493+Deepak91168@users.noreply.github.com>
54+
Deepak Singh <negid0253@gmail.com>
4155
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
4256
Dev Goel <135586571+corsairier@users.noreply.github.com>
4357
Dhanyabad behera <110620935+dhanyabad11@users.noreply.github.com>
@@ -53,11 +67,15 @@ Frank Kovacs <fran70kk@gmail.com>
5367
GK Bishnoi <gkishan1kyt@gmail.com>
5468
GURU PRASAD SHARMA <168292003+GURUPRASADSHARMA@users.noreply.github.com>
5569
Gaurav <gaurav70380@gmail.com>
70+
Gaurav Kaushik <144526331+Gauravkaushik-1206@users.noreply.github.com>
71+
Gautam Kaushik <162317291+Kaushikgtm@users.noreply.github.com>
5672
Gautam sharma <gautamkrishnasharma1@gmail.com>
73+
GeoDaoyu <geodaoyu@foxmail.com>
5774
Girish Garg <garggirish2020@gmail.com>
5875
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
5976
Gunj Joshi <gunjjoshi8372@gmail.com>
6077
Gururaj Gurram <gururajgurram1512@gmail.com>
78+
Harishchandra Reddy <harish.7000@gmail.com>
6179
Haroon Rasheed <51189276+haroon26@users.noreply.github.com>
6280
Harsh <harshyadav6078@gmail.com>
6381
HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
@@ -80,6 +98,7 @@ Joris Labie <joris.labie1@gmail.com>
8098
Justin Dennison <justin1dennison@gmail.com>
8199
Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
82100
Karan Anand <anandkarancompsci@gmail.com>
101+
Karan Vasudevamurthy <karanlvm123@gmail.com>
83102
Karan Yadav <77043443+karanBRAVO@users.noreply.github.com>
84103
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
85104
Kaushikgtm <162317291+Kaushikgtm@users.noreply.github.com>
@@ -89,6 +108,7 @@ Krishnam Agarwal <83017176+888krishnam@users.noreply.github.com>
89108
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
90109
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
91110
Lalit Narayan Yadav <162928571+LalitNarayanYadav@users.noreply.github.com>
111+
Lokesh Ranjan <lokesh.ranjan.phe23@itbhu.ac.in>
92112
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
93113
MANI <77221000+Eternity0207@users.noreply.github.com>
94114
Mahfuza Humayra Mohona <mhmohona@gmail.com>
@@ -104,6 +124,8 @@ Momtchil Momtchev <momtchil@momtchev.com>
104124
Muhammad Haris <harriskhan047@outlook.com>
105125
Muhammad Taaha Tariq <166188821+Taaha-Tariq@users.noreply.github.com>
106126
Muhmmad Saad <106260977+saad-imran-dev@users.noreply.github.com>
127+
NEEKUorAAYUSH <aayush10072004@gmail.com>
128+
Nakul Krishnakumar <nakulkrishnakumar86@gmail.com>
107129
Naresh Jagadeesan <naresh.naresh000@gmail.com>
108130
Naveen Kumar <stupiddint@gmail.com>
109131
Neeraj Pathak <neerajrpathak710@gmail.com>
@@ -116,7 +138,10 @@ Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
116138
Ognjen Jevremović <ognjenjevremovic@users.noreply.github.com>
117139
Oneday12323 <107678750+Oneday12323@users.noreply.github.com>
118140
Ori Miles <97595296+orimiles5@users.noreply.github.com>
141+
Payal Goswami <payalgoswami9711@gmail.com>
119142
Philipp Burckhardt <pburckhardt@outlook.com>
143+
Pierre Forstmann <15964998+pierreforstmann@users.noreply.github.com>
144+
Pradyumn Prasad <pradyumnprasad.567@gmail.com>
120145
Prajjwal Bajpai <142303989+prajjwalbajpai@users.noreply.github.com>
121146
Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
122147
Pranav Goswami <pranavchiku11@gmail.com>
@@ -145,25 +170,32 @@ Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
145170
Ryan Seal <splrk@users.noreply.github.com>
146171
Rylan Yang <137365285+rylany27@users.noreply.github.com>
147172
SAHIL KUMAR <168997976+sahilk45@users.noreply.github.com>
173+
SAUJANYA MAGARDE <162047941+SaujanyaMagarde@users.noreply.github.com>
148174
SHIVAM YADAV <120725381+Shivam-1827@users.noreply.github.com>
149175
Sachin Raj <120590207+schnrj@users.noreply.github.com>
150176
Sahil Goyal <87982509+sahil20021008@users.noreply.github.com>
151177
Sai Avinash <120403424+nasarobot@users.noreply.github.com>
152178
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
153179
Sanchay Ketan Sinha <122982233+satansin123@users.noreply.github.com>
154180
Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
181+
Satyajeet Chavan <chavansatyajeet2004@gmail.com>
155182
Saurabh Singh <saurabhsraghuvanshi@gmail.com>
183+
Seth-Banker <125103042+Seth-Banker@users.noreply.github.com>
156184
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
157185
Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com>
158186
Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
187+
Shaswata Panda <106397517+shaswata-26@users.noreply.github.com>
159188
Shivam Ahir <11shivam00@gmail.com>
189+
Shivansh <114570926+shiv343@users.noreply.github.com>
160190
Shraddheya Shendre <shendreshraddheya@gmail.com>
161191
Shubh Mehta <93862397+Shubh942@users.noreply.github.com>
162192
Shubham Mishra <shubh622005@gmail.com>
193+
Siddhesh waje <117733253+siddhesh434@users.noreply.github.com>
163194
Sivam Das <100067002+Sivam2313@users.noreply.github.com>
164195
Snehil Shah <snehilshah.989@gmail.com>
165196
Soumajit Chatterjee <121816890+soumajit23@users.noreply.github.com>
166197
Spandan Barve <contact@marsian.dev>
198+
Srinivas Batthula <srinivasbatthula05.official@gmail.com>
167199
Stephannie Jiménez Gacha <steff456@hotmail.com>
168200
Suhaib Ilahi <suhaib.elahi87@gmail.com>
169201
Suraj Kumar <125961509+kumarsuraj212003@users.noreply.github.com>
@@ -172,25 +204,32 @@ Tanishq Ahuja <68651083+TheGEN1U5@users.noreply.github.com>
172204
Tirtadwipa Manunggal <tirtadwipa.manunggal@gmail.com>
173205
Tudor Pagu <104032457+tudor-pagu@users.noreply.github.com>
174206
Tufailahmed Bargir <142114244+Tufailahmed-Bargir@users.noreply.github.com>
207+
Tushar Bhardwaj <155543597+TusharBhardwaj441@users.noreply.github.com>
208+
Tyson Cung <45380903+tysoncung@users.noreply.github.com>
175209
Uday Kakade <141299403+udaykakade25@users.noreply.github.com>
210+
Ujjwal Kirti <64329707+ujjwalkirti@users.noreply.github.com>
176211
Utkarsh <http://utkarsh11105@gmail.com>
177212
Utkarsh Raj <rajutkarsh2505@gmail.com>
178213
UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
179214
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
215+
Vansh Choudhary <iamvanshchaudhary7@gmail.com>
180216
Vara Rahul Rajana <123227543+rajanarahul93@users.noreply.github.com>
181217
Varad Gupta <varadgupta21@gmail.com>
182218
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
183219
Vivek Maurya <vm8118134@gmail.com>
220+
Wendy Yuchen Sun <wendyyuchensun@gmail.com>
184221
Xiaochuan Ye <tap91624@gmail.com>
185222
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
186223
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
187224
Yugal Kaushik <yugalkaushik14@gmail.com>
188225
Yuvi Mittal <128018763+yuvi-mittal@users.noreply.github.com>
226+
deepak427 <62477872+deepak427@users.noreply.github.com>
189227
devshree-bhati <147095250+devshree-bhati@users.noreply.github.com>
190228
ditsu <170345142+ditsus@users.noreply.github.com>
191229
ekambains <bainsinbusiness@gmail.com>
192230
fadiothman22 <48636283+fadiothman22@users.noreply.github.com>
193231
iraandrushko <71790513+iraandrushko@users.noreply.github.com>
232+
jsai28 <54253219+jsai28@users.noreply.github.com>
194233
lohithganni <116790357+lohithganni@users.noreply.github.com>
195234
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
196235
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ limitations under the License.
3333

3434
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
3535

36-
> Return the number of bytes per element provided an underlying [array data type][@stdlib/ndarray/dtypes].
36+
> Return the number of bytes per element for a provided underlying [ndarray data type][@stdlib/ndarray/dtypes].
3737
3838
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
3939

@@ -75,7 +75,7 @@ var bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' );
7575

7676
#### bytesPerElement( dtype )
7777

78-
Returns the number of bytes per element provided an underlying [array data type][@stdlib/ndarray/dtypes].
78+
Returns the number of bytes per element for a provided underlying [ndarray data type][@stdlib/ndarray/dtypes].
7979

8080
```javascript
8181
var nbytes = bytesPerElement( 'float64' );
@@ -115,11 +115,7 @@ var nbytes = bytesPerElement( 'foobar' );
115115
```javascript
116116
var bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' );
117117

118-
var dtypes;
119-
var nbytes;
120-
var i;
121-
122-
dtypes = [
118+
var dtypes = [
123119
'float64',
124120
'float32',
125121
'int8',
@@ -134,6 +130,8 @@ dtypes = [
134130
'foobar'
135131
];
136132

133+
var nbytes;
134+
var i;
137135
for ( i = 0; i < dtypes.length; i++ ) {
138136
nbytes = bytesPerElement( dtypes[ i ] );
139137
nbytes = ( nbytes ) ? nbytes+' bytes' : 'null';

benchmark/benchmark.js

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24+
var DataType = require( '@stdlib/ndarray-dtype-ctor' );
25+
var structFactory = require( '@stdlib/dstructs-struct' );
2426
var pkg = require( './../package.json' ).name;
2527
var bytesPerElement = require( './../lib' );
2628

2729

2830
// MAIN //
2931

30-
bench( pkg, function benchmark( b ) {
32+
bench( pkg+'::string', function benchmark( b ) {
3133
var dtypes;
3234
var dtype;
3335
var out;
@@ -63,3 +65,125 @@ bench( pkg, function benchmark( b ) {
6365
b.pass( 'benchmark finished' );
6466
b.end();
6567
});
68+
69+
bench( pkg+'::struct', function benchmark( b ) {
70+
var schemas;
71+
var dtypes;
72+
var dtype;
73+
var out;
74+
var i;
75+
76+
schemas = [
77+
[
78+
{
79+
'name': 'foo',
80+
'type': 'float64'
81+
}
82+
],
83+
[
84+
{
85+
'name': 'foo',
86+
'type': 'float32'
87+
}
88+
]
89+
];
90+
91+
dtypes = [
92+
structFactory( schemas[ 0 ] ),
93+
structFactory( schemas[ 1 ] )
94+
];
95+
96+
b.tic();
97+
for ( i = 0; i < b.iterations; i++ ) {
98+
dtype = dtypes[ i%dtypes.length ];
99+
out = bytesPerElement( dtype );
100+
if ( out !== out ) {
101+
b.fail( 'should not return NaN' );
102+
}
103+
}
104+
b.toc();
105+
if ( out !== out ) {
106+
b.fail( 'should not return NaN' );
107+
}
108+
b.pass( 'benchmark finished' );
109+
b.end();
110+
});
111+
112+
bench( pkg+'::data_type_instance,string', function benchmark( b ) {
113+
var dtypes;
114+
var dtype;
115+
var out;
116+
var i;
117+
118+
dtypes = [
119+
new DataType( 'float64' ),
120+
new DataType( 'float32' ),
121+
new DataType( 'int8' ),
122+
new DataType( 'uint8' ),
123+
new DataType( 'uint8c' ),
124+
new DataType( 'int16' ),
125+
new DataType( 'uint16' ),
126+
new DataType( 'int32' ),
127+
new DataType( 'uint32' ),
128+
new DataType( 'binary' ),
129+
new DataType( 'generic' )
130+
];
131+
132+
b.tic();
133+
for ( i = 0; i < b.iterations; i++ ) {
134+
dtype = dtypes[ i%dtypes.length ];
135+
out = bytesPerElement( dtype );
136+
if ( out !== out ) {
137+
b.fail( 'should not return NaN' );
138+
}
139+
}
140+
b.toc();
141+
if ( out !== out ) {
142+
b.fail( 'should not return NaN' );
143+
}
144+
b.pass( 'benchmark finished' );
145+
b.end();
146+
});
147+
148+
bench( pkg+'::data_type_instance,struct', function benchmark( b ) {
149+
var schemas;
150+
var dtypes;
151+
var dtype;
152+
var out;
153+
var i;
154+
155+
schemas = [
156+
[
157+
{
158+
'name': 'foo',
159+
'type': 'float64'
160+
}
161+
],
162+
[
163+
{
164+
'name': 'foo',
165+
'type': 'float32'
166+
}
167+
]
168+
];
169+
170+
dtypes = [
171+
new DataType( structFactory( schemas[ 0 ] ) ),
172+
new DataType( structFactory( schemas[ 1 ] ) )
173+
];
174+
175+
b.tic();
176+
for ( i = 0; i < b.iterations; i++ ) {
177+
dtype = dtypes[ i%dtypes.length ];
178+
out = bytesPerElement( dtype );
179+
if ( out !== out ) {
180+
b.fail( 'should not return NaN' );
181+
}
182+
}
183+
b.toc();
184+
if ( out !== out ) {
185+
b.fail( 'should not return NaN' );
186+
}
187+
b.pass( 'benchmark finished' );
188+
b.end();
189+
});

0 commit comments

Comments
 (0)