Skip to content

Commit 06667ad

Browse files
committed
feat: add accumulation and index data type policies
--- 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: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent e931ab0 commit 06667ad

File tree

7 files changed

+102
-22
lines changed

7 files changed

+102
-22
lines changed

lib/node_modules/@stdlib/ndarray/output-dtype-policies/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The output array contains the following data type policies:
5353

5454
- `same`: return the same data type.
5555
- `promoted`: return a promoted data type.
56+
- `accumulation`: return a data type amenable to accumulation.
5657
- `boolean`: return a boolean data type.
5758
- `boolean_and_generic`: return a boolean or "generic" data type.
5859
- `signed_integer`: return a signed integer data type.
@@ -71,7 +72,14 @@ The output array contains the following data type policies:
7172
- `real_and_generic`: return a real-valued or "generic" data type.
7273
- `numeric`: return a numeric data type.
7374
- `numeric_and_generic`: return a numeric or "generic" data type.
75+
- `integer_index`: return an integer index data type.
76+
- `integer_index_and_generic`: return an integer index or "generic" data type.
77+
- `boolean_index`: return a boolean index data type.
78+
- `boolean_index_and_generic`: return a boolean index or "generic" data type.
79+
- `mask_index`: return a mask index data type.
80+
- `mask_index_and_generic`: return a mask index or "generic" data type.
7481
- `default`: return the default data type.
82+
- `default_index`: return the default index data type.
7583

7684
</section>
7785

lib/node_modules/@stdlib/ndarray/output-dtype-policies/docs/repl.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- same: return the same data type.
88
- promoted: return a promoted data type.
9+
- accumulation: return a data type amenable to accumulation.
910
- boolean: return a boolean data type.
1011
- boolean_and_generic: return a boolean or "generic" data type.
1112
- signed_integer: return a signed integer data type.
@@ -34,7 +35,14 @@
3435
- real_and_generic: return a real-valued or "generic" data type.
3536
- numeric: return a numeric data type.
3637
- numeric_and_generic: return a numeric or "generic" data type.
38+
- integer_index: return an integer index data type.
39+
- integer_index_and_generic: return an integer index or "generic" data type.
40+
- boolean_index: return a boolean index data type.
41+
- boolean_index_and_generic: return a boolean index or "generic" data type.
42+
- mask_index: return a mask index data type.
43+
- mask_index_and_generic: return a mask index or "generic" data type.
3744
- default: return the default data type.
45+
- default_index: return the default index data type.
3846

3947
Returns
4048
-------

lib/node_modules/@stdlib/ndarray/output-dtype-policies/docs/types/index.d.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
type Policies = [
2525
'same',
2626
'promoted',
27+
'accumulation',
2728
'boolean',
2829
'boolean_and_generic',
2930
'signed_integer',
@@ -42,7 +43,14 @@ type Policies = [
4243
'real',
4344
'numeric',
4445
'numeric_and_generic',
45-
'default'
46+
'integer_index',
47+
'integer_index_and_generic',
48+
'boolean_index',
49+
'boolean_index_and_generic',
50+
'mask_index',
51+
'mask_index_and_generic',
52+
'default',
53+
'default_index'
4654
];
4755

4856
/**
@@ -54,6 +62,7 @@ type Policies = [
5462
*
5563
* - `same`: return the same data type.
5664
* - `promoted`: return a promoted data type.
65+
* - `accumulation`: return a data type amenable to accumulation.
5766
* - `boolean`: return a boolean data type.
5867
* - `boolean_and_generic`: return a boolean or "generic" data type.
5968
* - `signed_integer`: return a signed integer data type.
@@ -72,7 +81,14 @@ type Policies = [
7281
* - `real_and_generic`: return a real-valued or "generic" data type.
7382
* - `numeric`: return a numeric data type.
7483
* - `numeric_and_generic`: return a numeric or "generic" data type.
84+
* - `integer_index`: return an integer index data type.
85+
* - `integer_index_and_generic`: return an integer index or "generic" data type.
86+
* - `boolean_index`: return a boolean index data type.
87+
* - `boolean_index_and_generic`: return a boolean index or "generic" data type.
88+
* - `mask_index`: return a mask index data type.
89+
* - `mask_index_and_generic`: return a mask index or "generic" data type.
7590
* - `default`: return the default data type.
91+
* - `default_index`: return the default index data type.
7692
*
7793
* @returns list of data type policies
7894
*

lib/node_modules/@stdlib/ndarray/output-dtype-policies/include/stdlib/ndarray/output_dtype_policies.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ enum STDLIB_NDARRAY_OUTPUT_DTYPE_POLICY {
3636
// Return a promoted data type:
3737
STDLIB_NDARRAY_OUTPUT_POLICY_PROMOTED,
3838

39+
// Return a data type amenable to accumulation:
40+
STDLIB_NDARRAY_OUTPUT_POLICY_ACCUMULATION,
41+
3942
// Return a boolean data type:
4043
STDLIB_NDARRAY_OUTPUT_POLICY_BOOLEAN,
4144

@@ -90,9 +93,30 @@ enum STDLIB_NDARRAY_OUTPUT_DTYPE_POLICY {
9093
// Return a numeric or "generic" (JavaScript object) data type:
9194
STDLIB_NDARRAY_OUTPUT_POLICY_NUMERIC_AND_GENERIC,
9295

96+
// Return an integer index data type:
97+
STDLIB_NDARRAY_OUTPUT_POLICY_INTEGER_INDEX,
98+
99+
// Return an integer index or "generic" (JavaScript object) data type:
100+
STDLIB_NDARRAY_OUTPUT_POLICY_INTEGER_INDEX_AND_GENERIC,
101+
102+
// Return a boolean index data type:
103+
STDLIB_NDARRAY_OUTPUT_POLICY_BOOLEAN_INDEX,
104+
105+
// Return a boolean index or "generic" (JavaScript object) data type:
106+
STDLIB_NDARRAY_OUTPUT_POLICY_BOOLEAN_INDEX_AND_GENERIC,
107+
108+
// Return a mask index data type:
109+
STDLIB_NDARRAY_OUTPUT_POLICY_MASK_INDEX,
110+
111+
// Return a mask index or "generic" (JavaScript object) data type:
112+
STDLIB_NDARRAY_OUTPUT_POLICY_MASK_INDEX_AND_GENERIC,
113+
93114
// Return the default data type:
94115
STDLIB_NDARRAY_OUTPUT_POLICY_DEFAULT,
95116

117+
// Return the default index data type:
118+
STDLIB_NDARRAY_OUTPUT_POLICY_DEFAULT_INDEX,
119+
96120
// "Compute" the number of data type policies (this works because of how `enum` works: the value is automatically set to the last enumerated type plus 1):
97121
STDLIB_NDARRAY_NPOLICIES,
98122

lib/node_modules/@stdlib/ndarray/output-dtype-policies/lib/enum.js

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,33 @@ function enumeration() {
4040
return {
4141
'same': 0,
4242
'promoted': 1,
43-
'boolean': 2,
44-
'boolean_and_generic': 3,
45-
'signed_integer': 4,
46-
'signed_integer_and_generic': 5,
47-
'unsigned_integer': 6,
48-
'unsigned_integer_and_generic': 7,
49-
'integer': 8,
50-
'integer_and_generic': 9,
51-
'floating_point': 10,
52-
'floating_point_and_generic': 11,
53-
'real_floating_point': 12,
54-
'real_floating_point_and_generic': 13,
55-
'complex_floating_point': 14,
56-
'complex_floating_point_and_generic': 15,
57-
'real': 16,
58-
'real_and_generic': 17,
59-
'numeric': 18,
60-
'numeric_and_generic': 19,
61-
'default': 20
43+
'accumulation': 2,
44+
'boolean': 3,
45+
'boolean_and_generic': 4,
46+
'signed_integer': 5,
47+
'signed_integer_and_generic': 6,
48+
'unsigned_integer': 7,
49+
'unsigned_integer_and_generic': 8,
50+
'integer': 9,
51+
'integer_and_generic': 10,
52+
'floating_point': 11,
53+
'floating_point_and_generic': 12,
54+
'real_floating_point': 13,
55+
'real_floating_point_and_generic': 14,
56+
'complex_floating_point': 15,
57+
'complex_floating_point_and_generic': 16,
58+
'real': 17,
59+
'real_and_generic': 18,
60+
'numeric': 19,
61+
'numeric_and_generic': 20,
62+
'integer_index': 21,
63+
'integer_index_and_generic': 22,
64+
'boolean_index': 23,
65+
'boolean_index_and_generic': 24,
66+
'mask_index': 25,
67+
'mask_index_and_generic': 26,
68+
'default': 27,
69+
'default_index': 28
6270
};
6371
}
6472

lib/node_modules/@stdlib/ndarray/output-dtype-policies/lib/policies.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
22
"same",
33
"promoted",
4+
"accumulation",
45
"boolean",
56
"boolean_and_generic",
67
"signed_integer",
@@ -19,5 +20,12 @@
1920
"real",
2021
"numeric",
2122
"numeric_and_generic",
22-
"default"
23+
"integer_index",
24+
"integer_index_and_generic",
25+
"boolean_index",
26+
"boolean_index_and_generic",
27+
"mask_index",
28+
"mask_index_and_generic",
29+
"default",
30+
"default_index"
2331
]

lib/node_modules/@stdlib/ndarray/output-dtype-policies/test/test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ var policies = require( './../lib' );
3232
var POLICIES = [
3333
'same',
3434
'promoted',
35+
'accumulation',
3536
'boolean',
3637
'boolean_and_generic',
3738
'signed_integer',
@@ -50,7 +51,14 @@ var POLICIES = [
5051
'real',
5152
'numeric',
5253
'numeric_and_generic',
53-
'default'
54+
'integer_index',
55+
'integer_index_and_generic',
56+
'boolean_index',
57+
'boolean_index_and_generic',
58+
'mask_index',
59+
'mask_index_and_generic',
60+
'default',
61+
'default_index'
5462
];
5563

5664

0 commit comments

Comments
 (0)