Skip to content

Commit 637de3c

Browse files
committed
refactor: modify script to exclude generic dtypes in addon
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent e23d8e5 commit 637de3c

File tree

9 files changed

+128
-228
lines changed

9 files changed

+128
-228
lines changed

lib/node_modules/@stdlib/math/special/fibonacci/lib/types.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ var types = [
8181
dtypes.uint8, dtypes.uint32,
8282
dtypes.uint8, dtypes.uint16,
8383
dtypes.uint8, dtypes.uint8,
84-
dtypes.uint8, dtypes.generic,
85-
86-
// generic (1)
87-
dtypes.generic, dtypes.float64
84+
dtypes.uint8, dtypes.generic
8885
];
8986

9087

lib/node_modules/@stdlib/math/special/fibonacci/scripts/generate_files.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,25 @@ function generateAddonFile( matches, header, basePkg ) {
251251
* @private
252252
*/
253253
function main() {
254+
var filteredMatches;
254255
var basePkg;
255256
var matches;
256257
var header;
257258
var jsOut;
258259
var cOut;
260+
var i;
259261

260262
// Generate and filter matches table:
261263
matches = generateMatchesTable();
262264

265+
// Filter out generic types for addon.c:
266+
filteredMatches = [];
267+
for ( i = 0; i < matches.length; i++ ) {
268+
if ( matches[ i ][ 0 ] !== 'generic' && matches[ i ][ 1 ] !== 'generic' ) {
269+
filteredMatches.push( matches[ i ] );
270+
}
271+
}
272+
263273
// Extract package information:
264274
basePkg = pkg.name.split( '/' ).pop();
265275

@@ -277,7 +287,7 @@ function main() {
277287
});
278288

279289
// Generate addon.c:
280-
cOut = generateAddonFile( matches, header, basePkg );
290+
cOut = generateAddonFile( filteredMatches, header, basePkg );
281291
writeFileSync( join( __dirname, '../src/addon.c' ), cOut, {
282292
'encoding': 'utf8'
283293
});

lib/node_modules/@stdlib/math/special/fibonacci/scripts/script.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ function main() {
250250
*/
251251

252252
if ( inputDtype === 'generic' ) {
253-
// For generic input, generate mappings to highest precision dtypes:
254-
allowedCasts = [ 'float64', 'complex128' ];
253+
continue;
255254
} else {
256255
// Get all dtypes this input can be mostly-safely cast to:
257256
allowedCasts = mostlySafeCasts( inputDtype );

lib/node_modules/@stdlib/math/special/fibonacci/src/addon.c

Lines changed: 60 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -30,181 +30,148 @@ static const char name[] = "stdlib_ndarray_fibonacci";
3030

3131
// Define a list of ndarray functions:
3232
static ndarrayFcn functions[] = {
33-
// float32 (3)
34-
stdlib_ndarray_f_d_as_i_d,
35-
stdlib_ndarray_f_f_as_i_f,
36-
stdlib_ndarray_f_o_as_i_d,
37-
38-
// float64 (3)
39-
stdlib_ndarray_d_d_as_i_d,
40-
stdlib_ndarray_d_f_as_i_d,
41-
stdlib_ndarray_d_o_as_i_d,
42-
43-
// int16 (5)
44-
stdlib_ndarray_k_d_as_i_d,
45-
stdlib_ndarray_k_f_as_i_f,
46-
stdlib_ndarray_k_i_as_i_f,
47-
stdlib_ndarray_k_k_as_i_f,
48-
stdlib_ndarray_k_o_as_i_d,
49-
50-
// int32 (3)
33+
// float32 (2)
34+
undefined,
35+
undefined,
36+
37+
// float64 (2)
38+
undefined,
39+
undefined,
40+
41+
// int16 (4)
42+
undefined,
43+
undefined,
44+
undefined,
45+
undefined,
46+
47+
// int32 (2)
5148
stdlib_ndarray_i_d,
52-
stdlib_ndarray_i_i_as_i_f,
53-
stdlib_ndarray_i_o_as_i_d,
54-
55-
// int8 (6)
56-
stdlib_ndarray_s_d_as_i_d,
57-
stdlib_ndarray_s_f_as_i_f,
58-
stdlib_ndarray_s_i_as_i_f,
59-
stdlib_ndarray_s_k_as_i_f,
60-
stdlib_ndarray_s_s_as_i_f,
61-
stdlib_ndarray_s_o_as_i_d,
62-
63-
// uint16 (6)
64-
stdlib_ndarray_t_d_as_i_d,
65-
stdlib_ndarray_t_f_as_i_f,
66-
stdlib_ndarray_t_i_as_i_f,
67-
stdlib_ndarray_t_u_as_i_f,
68-
stdlib_ndarray_t_t_as_i_f,
69-
stdlib_ndarray_t_o_as_i_d,
70-
71-
// uint32 (3)
72-
stdlib_ndarray_u_d_as_i_d,
73-
stdlib_ndarray_u_u_as_i_f,
74-
stdlib_ndarray_u_o_as_i_d,
75-
76-
// uint8 (8)
77-
stdlib_ndarray_b_d_as_i_d,
78-
stdlib_ndarray_b_f_as_i_f,
79-
stdlib_ndarray_b_i_as_i_f,
80-
stdlib_ndarray_b_k_as_i_f,
81-
stdlib_ndarray_b_u_as_i_f,
82-
stdlib_ndarray_b_t_as_i_f,
83-
stdlib_ndarray_b_b_as_i_f,
84-
stdlib_ndarray_b_o_as_i_d,
85-
86-
// generic (1)
87-
stdlib_ndarray_o_d_as_i_d,
49+
undefined,
50+
51+
// int8 (5)
52+
undefined,
53+
undefined,
54+
undefined,
55+
undefined,
56+
undefined,
57+
58+
// uint16 (5)
59+
undefined,
60+
undefined,
61+
undefined,
62+
undefined,
63+
undefined,
64+
65+
// uint32 (2)
66+
undefined,
67+
undefined,
68+
69+
// uint8 (7)
70+
undefined,
71+
undefined,
72+
undefined,
73+
undefined,
74+
undefined,
75+
undefined,
76+
undefined,
8877

8978
};
9079

9180
// Define the array of input and output ndarray types:
9281
static int32_t types[] = {
93-
// float32 (3)
82+
// float32 (2)
9483
STDLIB_NDARRAY_FLOAT32, STDLIB_NDARRAY_FLOAT64,
9584
STDLIB_NDARRAY_FLOAT32, STDLIB_NDARRAY_FLOAT32,
96-
STDLIB_NDARRAY_FLOAT32, STDLIB_NDARRAY_GENERIC,
9785

98-
// float64 (3)
86+
// float64 (2)
9987
STDLIB_NDARRAY_FLOAT64, STDLIB_NDARRAY_FLOAT64,
10088
STDLIB_NDARRAY_FLOAT64, STDLIB_NDARRAY_FLOAT32,
101-
STDLIB_NDARRAY_FLOAT64, STDLIB_NDARRAY_GENERIC,
10289

103-
// int16 (5)
90+
// int16 (4)
10491
STDLIB_NDARRAY_INT16, STDLIB_NDARRAY_FLOAT64,
10592
STDLIB_NDARRAY_INT16, STDLIB_NDARRAY_FLOAT32,
10693
STDLIB_NDARRAY_INT16, STDLIB_NDARRAY_INT32,
10794
STDLIB_NDARRAY_INT16, STDLIB_NDARRAY_INT16,
108-
STDLIB_NDARRAY_INT16, STDLIB_NDARRAY_GENERIC,
10995

110-
// int32 (3)
96+
// int32 (2)
11197
STDLIB_NDARRAY_INT32, STDLIB_NDARRAY_FLOAT64,
11298
STDLIB_NDARRAY_INT32, STDLIB_NDARRAY_INT32,
113-
STDLIB_NDARRAY_INT32, STDLIB_NDARRAY_GENERIC,
11499

115-
// int8 (6)
100+
// int8 (5)
116101
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_FLOAT64,
117102
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_FLOAT32,
118103
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_INT32,
119104
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_INT16,
120105
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_INT8,
121-
STDLIB_NDARRAY_INT8, STDLIB_NDARRAY_GENERIC,
122106

123-
// uint16 (6)
107+
// uint16 (5)
124108
STDLIB_NDARRAY_UINT16, STDLIB_NDARRAY_FLOAT64,
125109
STDLIB_NDARRAY_UINT16, STDLIB_NDARRAY_FLOAT32,
126110
STDLIB_NDARRAY_UINT16, STDLIB_NDARRAY_INT32,
127111
STDLIB_NDARRAY_UINT16, STDLIB_NDARRAY_UINT32,
128112
STDLIB_NDARRAY_UINT16, STDLIB_NDARRAY_UINT16,
129-
STDLIB_NDARRAY_UINT16, STDLIB_NDARRAY_GENERIC,
130113

131-
// uint32 (3)
114+
// uint32 (2)
132115
STDLIB_NDARRAY_UINT32, STDLIB_NDARRAY_FLOAT64,
133116
STDLIB_NDARRAY_UINT32, STDLIB_NDARRAY_UINT32,
134-
STDLIB_NDARRAY_UINT32, STDLIB_NDARRAY_GENERIC,
135117

136-
// uint8 (8)
118+
// uint8 (7)
137119
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_FLOAT64,
138120
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_FLOAT32,
139121
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_INT32,
140122
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_INT16,
141123
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_UINT32,
142124
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_UINT16,
143125
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_UINT8,
144-
STDLIB_NDARRAY_UINT8, STDLIB_NDARRAY_GENERIC,
145-
146-
// generic (1)
147-
STDLIB_NDARRAY_GENERIC, STDLIB_NDARRAY_FLOAT64,
148126

149127
};
150128

151129
// Define a list of ndarray function "data" (in this case, callbacks):
152130
static void *data[] = {
153-
// float32 (3)
131+
// float32 (2)
154132
(void *)stdlib_math_base_special_fibonacci,
155133
(void *)stdlib_math_base_special_fibonaccif,
156-
(void *)stdlib_math_base_special_fibonacci,
157134

158-
// float64 (3)
159-
(void *)stdlib_math_base_special_fibonacci,
135+
// float64 (2)
160136
(void *)stdlib_math_base_special_fibonacci,
161137
(void *)stdlib_math_base_special_fibonacci,
162138

163-
// int16 (5)
139+
// int16 (4)
164140
(void *)stdlib_math_base_special_fibonacci,
165141
(void *)stdlib_math_base_special_fibonaccif,
166142
(void *)stdlib_math_base_special_fibonaccif,
167143
(void *)stdlib_math_base_special_fibonaccif,
168-
(void *)stdlib_math_base_special_fibonacci,
169144

170-
// int32 (3)
145+
// int32 (2)
171146
(void *)stdlib_math_base_special_fibonacci,
172147
(void *)stdlib_math_base_special_fibonaccif,
173-
(void *)stdlib_math_base_special_fibonacci,
174148

175-
// int8 (6)
149+
// int8 (5)
176150
(void *)stdlib_math_base_special_fibonacci,
177151
(void *)stdlib_math_base_special_fibonaccif,
178152
(void *)stdlib_math_base_special_fibonaccif,
179153
(void *)stdlib_math_base_special_fibonaccif,
180154
(void *)stdlib_math_base_special_fibonaccif,
181-
(void *)stdlib_math_base_special_fibonacci,
182155

183-
// uint16 (6)
156+
// uint16 (5)
184157
(void *)stdlib_math_base_special_fibonacci,
185158
(void *)stdlib_math_base_special_fibonaccif,
186159
(void *)stdlib_math_base_special_fibonaccif,
187160
(void *)stdlib_math_base_special_fibonaccif,
188161
(void *)stdlib_math_base_special_fibonaccif,
189-
(void *)stdlib_math_base_special_fibonacci,
190162

191-
// uint32 (3)
163+
// uint32 (2)
192164
(void *)stdlib_math_base_special_fibonacci,
193165
(void *)stdlib_math_base_special_fibonaccif,
194-
(void *)stdlib_math_base_special_fibonacci,
195166

196-
// uint8 (8)
167+
// uint8 (7)
197168
(void *)stdlib_math_base_special_fibonacci,
198169
(void *)stdlib_math_base_special_fibonaccif,
199170
(void *)stdlib_math_base_special_fibonaccif,
200171
(void *)stdlib_math_base_special_fibonaccif,
201172
(void *)stdlib_math_base_special_fibonaccif,
202173
(void *)stdlib_math_base_special_fibonaccif,
203174
(void *)stdlib_math_base_special_fibonaccif,
204-
(void *)stdlib_math_base_special_fibonacci,
205-
206-
// generic (1)
207-
(void *)stdlib_math_base_special_fibonacci,
208175

209176
};
210177

@@ -226,7 +193,7 @@ static const struct ndarrayFunctionObject obj = {
226193
functions,
227194

228195
// Number of ndarray functions:
229-
38,
196+
29,
230197

231198
// Array of type "numbers" (as enumerated elsewhere), where the total number of types equals `narrays * nfunctions` and where each set of `narrays` consecutive types (non-overlapping) corresponds to the set of ndarray argument types for a corresponding ndarray function:
232199
types,

lib/node_modules/@stdlib/math/special/floor/lib/types.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,71 +54,58 @@ var types = [
5454
dtypes.float64, dtypes.complex64,
5555
dtypes.float64, dtypes.generic,
5656

57-
// int16 (8)
57+
// int16 (7)
5858
dtypes.int16, dtypes.float64,
5959
dtypes.int16, dtypes.float32,
60-
dtypes.int16, dtypes.int64,
6160
dtypes.int16, dtypes.int32,
6261
dtypes.int16, dtypes.int16,
6362
dtypes.int16, dtypes.complex128,
6463
dtypes.int16, dtypes.complex64,
6564
dtypes.int16, dtypes.generic,
6665

67-
// int32 (5)
66+
// int32 (4)
6867
dtypes.int32, dtypes.float64,
69-
dtypes.int32, dtypes.int64,
7068
dtypes.int32, dtypes.int32,
7169
dtypes.int32, dtypes.complex128,
7270
dtypes.int32, dtypes.generic,
7371

74-
// int8 (9)
72+
// int8 (8)
7573
dtypes.int8, dtypes.float64,
7674
dtypes.int8, dtypes.float32,
77-
dtypes.int8, dtypes.int64,
7875
dtypes.int8, dtypes.int32,
7976
dtypes.int8, dtypes.int16,
8077
dtypes.int8, dtypes.int8,
8178
dtypes.int8, dtypes.complex128,
8279
dtypes.int8, dtypes.complex64,
8380
dtypes.int8, dtypes.generic,
8481

85-
// uint16 (10)
82+
// uint16 (8)
8683
dtypes.uint16, dtypes.float64,
8784
dtypes.uint16, dtypes.float32,
88-
dtypes.uint16, dtypes.int64,
8985
dtypes.uint16, dtypes.int32,
90-
dtypes.uint16, dtypes.uint64,
9186
dtypes.uint16, dtypes.uint32,
9287
dtypes.uint16, dtypes.uint16,
9388
dtypes.uint16, dtypes.complex128,
9489
dtypes.uint16, dtypes.complex64,
9590
dtypes.uint16, dtypes.generic,
9691

97-
// uint32 (6)
92+
// uint32 (4)
9893
dtypes.uint32, dtypes.float64,
99-
dtypes.uint32, dtypes.int64,
100-
dtypes.uint32, dtypes.uint64,
10194
dtypes.uint32, dtypes.uint32,
10295
dtypes.uint32, dtypes.complex128,
10396
dtypes.uint32, dtypes.generic,
10497

105-
// uint8 (12)
98+
// uint8 (10)
10699
dtypes.uint8, dtypes.float64,
107100
dtypes.uint8, dtypes.float32,
108-
dtypes.uint8, dtypes.int64,
109101
dtypes.uint8, dtypes.int32,
110102
dtypes.uint8, dtypes.int16,
111-
dtypes.uint8, dtypes.uint64,
112103
dtypes.uint8, dtypes.uint32,
113104
dtypes.uint8, dtypes.uint16,
114105
dtypes.uint8, dtypes.uint8,
115106
dtypes.uint8, dtypes.complex128,
116107
dtypes.uint8, dtypes.complex64,
117-
dtypes.uint8, dtypes.generic,
118-
119-
// generic (2)
120-
dtypes.generic, dtypes.float64,
121-
dtypes.generic, dtypes.complex128
108+
dtypes.uint8, dtypes.generic
122109
];
123110

124111

0 commit comments

Comments
 (0)