Skip to content

Commit 7a27b8b

Browse files
committed
Auto-generated commit
1 parent 3730af7 commit 7a27b8b

File tree

8 files changed

+100
-20
lines changed

8 files changed

+100
-20
lines changed

.github/.keepalive

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

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,8 @@ acs-*.bib
176176
#################
177177
.vscode/
178178
jsconfig.json
179+
180+
# Sublime Text #
181+
################
182+
*.sublime-workspace
183+
*.sublime-project

CONTRIBUTORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ Ricky Reusser <rsreusser@gmail.com>
2525
Ryan Seal <splrk@users.noreply.github.com>
2626
Seyyed Parsa Neshaei <spneshaei@users.noreply.github.com>
2727
Shraddheya Shendre <shendreshraddheya@gmail.com>
28-
Stephannie Jimenez Gacha <steff456@users.noreply.github.com>
28+
Stephannie Jiménez Gacha <steff456@hotmail.com>
2929
dorrin-sot <59933477+dorrin-sot@users.noreply.github.com>
3030
rei2hu <rei2hu@users.noreply.github.com>

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ JAVASCRIPT_TEST ?= $(NODE_MODULES)/tape/bin/tape
239239
JAVASCRIPT_TEST_FLAGS ?=
240240

241241
# Define the path to the executable for parsing TAP output:
242-
TAP_REPORTER ?= $(BIN_DIR)/tap-spec
242+
TAP_REPORTER ?= $(BIN_DIR)/tap-min
243243

244244
# Define the path to the Istanbul executable:
245245
ISTANBUL ?= $(BIN_DIR)/istanbul

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var callbacks = require( '@stdlib/strided-base-binary-signature-callbacks' );
6262

6363
#### callbacks( table, signatures )
6464

65-
Assigns callbacks to binary interfaces according to type type [promotion rules][@stdlib/ndarray/promotion-rules].
65+
Assigns callbacks to binary interfaces according to type [promotion rules][@stdlib/ndarray/promotion-rules].
6666

6767
```javascript
6868
var signatures = require( '@stdlib/strided-base-binary-dtype-signatures' );
@@ -93,7 +93,7 @@ var list = callbacks( table, sigs );
9393
The function accepts the following arguments:
9494

9595
- **table**: callback table.
96-
- **signatures**: options.
96+
- **signatures**: strided array containing binary interface signatures.
9797

9898
A callback `table` should have the following properties:
9999

docs/repl.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
Examples
3030
--------
3131
> var dt = {{alias:@stdlib/strided/dtypes}}();
32-
> var sigs = {{alias:@stdlib/strided/base/signatures}}( dt, dt, dt );
32+
> var sigs = {{alias:@stdlib/strided/base/binary-dtype-signatures}}( dt, dt, dt );
3333
> var t = {
3434
... 'default': {{alias:@stdlib/math/base/ops/add}},
3535
... 'complex64': {{alias:@stdlib/math/base/ops/caddf}},

lib/main.js

Lines changed: 89 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,102 @@ var CTORS = {
5252
* @returns {Function} callback
5353
*/
5454
function resolveCallback( table, t1, t2, t3 ) {
55-
if ( t3 === C64 || t3 === C128 ) {
56-
if ( t1 === t2 && t2 === t3 ) {
57-
return table[ t3 ];
55+
// The following branches attempt to follow type promotion rules; however, some accommodations are made for completeness...
56+
57+
// Signature: ??_z
58+
if ( t3 === C128 ) {
59+
// c?_z
60+
if ( t1 === C64 ) {
61+
// cz_z or cc_z
62+
if ( t2 === C128 || t2 === C64 ) {
63+
return table[ C128 ]; // Signature: cz_z_as_zz_z or cc_z_as_zz_z
64+
}
65+
// cd_z
66+
return wrap( table[ C128 ], 2, CTORS[ C128 ] ); // Signature: cd_z_as_zz_z
67+
}
68+
// z?_z
69+
if ( t1 === C128 ) {
70+
// zz_z or zc_z
71+
if ( t2 === C128 || t2 === C64 ) {
72+
return table[ C128 ]; // Signature: zz_z or zc_z_as_zz_z
73+
}
74+
// zd_z
75+
return wrap( table[ C128 ], 2, CTORS[ C128 ] ); // Signature: zd_z_as_zz_z
76+
}
77+
// dc_z, dz_z, or dd_z
78+
return wrap( table[ C128 ], 2, CTORS[ C128 ] ); // Signature: dc_z_as_zz_z, dz_z_as_zz_z, or dd_z_as_zz_z
79+
}
80+
// Signature: ??_c
81+
if ( t3 === C64 ) {
82+
// z?_c
83+
if ( t1 === C128 ) {
84+
// zc_c or zz_c (note: according to type promotion rules `zz_c` should not happen, as `z` does not promote to `c`, but we accommodate here anyway)
85+
if ( t2 === C64 || t2 === C128 ) {
86+
return table[ C128 ]; // Signature: zc_c_as_zz_z or zz_c_as_zz_z
87+
}
88+
// zd_c (note: according to type promotion rules `zd_c` should not happen, as neither `z` nor `d` promote to `c`, but we accommodate here anyway)
89+
return wrap( table[ C128 ], 2, CTORS[ C128 ] ); // Signature: zd_c_as_zz_z
90+
}
91+
// c?_c
92+
if ( t1 === C64 ) {
93+
// cz_c (note: according to type promotion rules `cz_c` should not happen, as `z` does not promote to `c`, but we accommodate here anyway)
94+
if ( t2 === C128 ) {
95+
return table[ C128 ]; // Signature: cz_c_as_zz_z
96+
}
97+
// cc_c
98+
if ( t2 === C64 ) {
99+
return table[ C64 ]; // Signature: cc_c
100+
}
101+
// cd_c (note: in JavaScript, real values are double-precision, but we downcast `d` to `c`, as, according to type promotion rules `cd_c` should not happen, as `d` does not promote to `c`, but `cf_c` can happen)
102+
return wrap( table[ C64 ], 2, CTORS[ C64 ] ); // Signature: cd_c_as_cc_c (cf_c_as_cc_c)
103+
}
104+
// dz_c
105+
if ( t2 === C128 ) {
106+
// Note: according to type promotion rules `dz_c` should not happen, as neither `z` nor `d` promote to `c`, but we accommodate here anyway
107+
return wrap( table[ C128 ], 2, CTORS[ C128 ] ); // Signature: zd_c_as_zz_z
108+
}
109+
// dc_c
110+
if ( t2 === C64 ) {
111+
// Note: in JavaScript, real values are double-precision, but we downcast `d` to `c`, as, according to type promotion rules `dc_c` should not happen, as `d` does not promote to `c`, but `fc_c` can happen
112+
return wrap( table[ C64 ], 2, CTORS[ C64 ] ); // Signature: dc_c_as_cc_c (fc_c_as_cc_c)
58113
}
59-
return wrap( table[ t3 ], 2, CTORS[ t3 ] );
114+
// dd_c (note: in JavaScript, real values are double-precision, but we downcast `d` to `c`, as, according to type promotion rules `dd_c` should not happen, as `d` does not promote to `c`, but `ff_c` can happen)
115+
return wrap( table[ C64 ], 2, CTORS[ C64 ] ); // Signature: dd_c_as_cc_c (ff_c_as_cc_c)
60116
}
117+
// Signature: ??_o
61118
if ( t3 === 'generic' ) {
62-
if ( t1 === C128 || t2 === C128 ) {
63-
if ( t1 === t2 ) {
64-
return table[ t1 ];
119+
// z?_o
120+
if ( t1 === C128 ) {
121+
// zz_o or zc_o
122+
if ( t2 === C128 || t2 === C64 ) {
123+
return table[ C128 ]; // Signature: zz_o_as_zz_z or zc_o_as_zz_z
65124
}
66-
return wrap( table[ C128 ], 2, CTORS[ C128 ] );
125+
// zd_o
126+
return wrap( table[ C128 ], 2, CTORS[ C128 ] ); // Signature: zd_o_as_zz_z
67127
}
68-
if ( t1 === C64 || t2 === C64 ) {
69-
if ( t1 === t2 ) {
70-
return table[ t1 ];
128+
// c?_o
129+
if ( t1 === C64 ) {
130+
// cc_o
131+
if ( t2 === C64 ) {
132+
return table[ C64 ]; // Signature: cc_o_as_cc_c
71133
}
72-
return wrap( table[ C64 ], 2, CTORS[ C64 ] );
134+
// cz_o
135+
if ( t2 === C128 ) {
136+
return table[ C128 ]; // Signature: cz_o_as_zz_z
137+
}
138+
// cd_o
139+
return wrap( table[ C64 ], 2, CTORS[ C64 ] ); // Signature: cd_o_as_cc_c
140+
}
141+
// dz_o
142+
if ( t2 === C128 ) {
143+
return wrap( table[ C128 ], 2, CTORS[ C128 ] ); // Signature: dz_o_as_zz_z
144+
}
145+
// dc_o
146+
if ( t2 === C64 ) {
147+
return wrap( table[ C64 ], 2, CTORS[ C64 ] ); // Signature: dc_o_as_cc_c
73148
}
74-
// Fall-through...
149+
// dd_o
150+
return table.default;
75151
}
76152
return table.default;
77153
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@stdlib/strided-dtypes": "^0.0.x",
5959
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
6060
"istanbul": "^0.4.1",
61-
"tap-spec": "5.x.x"
61+
"tap-min": "2.x.x"
6262
},
6363
"engines": {
6464
"node": ">=0.10.0",

0 commit comments

Comments
 (0)