@@ -27,23 +27,23 @@ import dcartesianProduct = require( './index' );
2727 const y = new Float64Array ( 2 ) ;
2828 const out = new Float64Array ( 8 ) ;
2929
30- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectType Float64Array
30+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectType Float64Array
3131}
3232
33- // The compiler throws an error if the function is provided a first argument which is not a number ...
33+ // The compiler throws an error if the function is provided a first argument which is not a string ...
3434{
3535 const x = new Float64Array ( 2 ) ;
3636 const y = new Float64Array ( 2 ) ;
3737 const out = new Float64Array ( 8 ) ;
3838
39- dcartesianProduct ( '10' , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
40- dcartesianProduct ( true , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
41- dcartesianProduct ( false , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
42- dcartesianProduct ( null , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
43- dcartesianProduct ( undefined , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
44- dcartesianProduct ( [ ] , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
45- dcartesianProduct ( { } , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
46- dcartesianProduct ( ( x : number ) : number => x , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
39+ dcartesianProduct ( 10 , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
40+ dcartesianProduct ( true , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
41+ dcartesianProduct ( false , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
42+ dcartesianProduct ( null , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
43+ dcartesianProduct ( undefined , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
44+ dcartesianProduct ( [ ] , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
45+ dcartesianProduct ( { } , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
46+ dcartesianProduct ( ( x : number ) : number => x , x . length , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
4747}
4848
4949// The compiler throws an error if the function is provided a second argument which is not a number...
@@ -52,110 +52,126 @@ import dcartesianProduct = require( './index' );
5252 const y = new Float64Array ( 2 ) ;
5353 const out = new Float64Array ( 8 ) ;
5454
55- dcartesianProduct ( x . length , '10' , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
56- dcartesianProduct ( x . length , true , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
57- dcartesianProduct ( x . length , false , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
58- dcartesianProduct ( x . length , null , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
59- dcartesianProduct ( x . length , undefined , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
60- dcartesianProduct ( x . length , [ ] , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
61- dcartesianProduct ( x . length , { } , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
62- dcartesianProduct ( x . length , ( x : number ) : number => x , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
55+ dcartesianProduct ( 'row-major' , '10' , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
56+ dcartesianProduct ( 'row-major' , true , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
57+ dcartesianProduct ( 'row-major' , false , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
58+ dcartesianProduct ( 'row-major' , null , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
59+ dcartesianProduct ( 'row-major' , undefined , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
60+ dcartesianProduct ( 'row-major' , [ ] , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
61+ dcartesianProduct ( 'row-major' , { } , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
62+ dcartesianProduct ( 'row-major' , ( x : number ) : number => x , y . length , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
6363}
6464
65- // The compiler throws an error if the function is provided a third argument which is not a Float64Array...
65+ // The compiler throws an error if the function is provided a third argument which is not a number...
66+ {
67+ const x = new Float64Array ( 2 ) ;
68+ const y = new Float64Array ( 2 ) ;
69+ const out = new Float64Array ( 8 ) ;
70+
71+ dcartesianProduct ( 'row-major' , x . length , '10' , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
72+ dcartesianProduct ( 'row-major' , x . length , true , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
73+ dcartesianProduct ( 'row-major' , x . length , false , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
74+ dcartesianProduct ( 'row-major' , x . length , null , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
75+ dcartesianProduct ( 'row-major' , x . length , undefined , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
76+ dcartesianProduct ( 'row-major' , x . length , [ ] , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
77+ dcartesianProduct ( 'row-major' , x . length , { } , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
78+ dcartesianProduct ( 'row-major' , x . length , ( x : number ) : number => x , x , 1 , y , 1 , out , 2 ) ; // $ExpectError
79+ }
80+
81+ // The compiler throws an error if the function is provided a fourth argument which is not a Float64Array...
6682{
6783 const y = new Float64Array ( 2 ) ;
6884 const out = new Float64Array ( 8 ) ;
6985
70- dcartesianProduct ( 2 , y . length , 10 , 1 , y , 1 , out , 2 ) ; // $ExpectError
71- dcartesianProduct ( 2 , y . length , '10' , 1 , y , 1 , out , 2 ) ; // $ExpectError
72- dcartesianProduct ( 2 , y . length , true , 1 , y , 1 , out , 2 ) ; // $ExpectError
73- dcartesianProduct ( 2 , y . length , false , 1 , y , 1 , out , 2 ) ; // $ExpectError
74- dcartesianProduct ( 2 , y . length , null , 1 , y , 1 , out , 2 ) ; // $ExpectError
75- dcartesianProduct ( 2 , y . length , undefined , 1 , y , 1 , out , 2 ) ; // $ExpectError
76- dcartesianProduct ( 2 , y . length , [ ] , 1 , y , 1 , out , 2 ) ; // $ExpectError
77- dcartesianProduct ( 2 , y . length , { } , 1 , y , 1 , out , 2 ) ; // $ExpectError
78- dcartesianProduct ( 2 , y . length , ( x : number ) : number => x , 1 , y , 1 , out , 2 ) ; // $ExpectError
86+ dcartesianProduct ( 'row-major' , 2 , y . length , 10 , 1 , y , 1 , out , 2 ) ; // $ExpectError
87+ dcartesianProduct ( 'row-major' , 2 , y . length , '10' , 1 , y , 1 , out , 2 ) ; // $ExpectError
88+ dcartesianProduct ( 'row-major' , 2 , y . length , true , 1 , y , 1 , out , 2 ) ; // $ExpectError
89+ dcartesianProduct ( 'row-major' , 2 , y . length , false , 1 , y , 1 , out , 2 ) ; // $ExpectError
90+ dcartesianProduct ( 'row-major' , 2 , y . length , null , 1 , y , 1 , out , 2 ) ; // $ExpectError
91+ dcartesianProduct ( 'row-major' , 2 , y . length , undefined , 1 , y , 1 , out , 2 ) ; // $ExpectError
92+ dcartesianProduct ( 'row-major' , 2 , y . length , [ ] , 1 , y , 1 , out , 2 ) ; // $ExpectError
93+ dcartesianProduct ( 'row-major' , 2 , y . length , { } , 1 , y , 1 , out , 2 ) ; // $ExpectError
94+ dcartesianProduct ( 'row-major' , 2 , y . length , ( x : number ) : number => x , 1 , y , 1 , out , 2 ) ; // $ExpectError
7995}
8096
81- // The compiler throws an error if the function is provided a fourth argument which is not a number...
97+ // The compiler throws an error if the function is provided a fifth argument which is not a number...
8298{
8399 const x = new Float64Array ( 2 ) ;
84100 const y = new Float64Array ( 2 ) ;
85101 const out = new Float64Array ( 8 ) ;
86102
87- dcartesianProduct ( x . length , y . length , x , '10' , y , 1 , out , 2 ) ; // $ExpectError
88- dcartesianProduct ( x . length , y . length , x , true , y , 1 , out , 2 ) ; // $ExpectError
89- dcartesianProduct ( x . length , y . length , x , false , y , 1 , out , 2 ) ; // $ExpectError
90- dcartesianProduct ( x . length , y . length , x , null , y , 1 , out , 2 ) ; // $ExpectError
91- dcartesianProduct ( x . length , y . length , x , undefined , y , 1 , out , 2 ) ; // $ExpectError
92- dcartesianProduct ( x . length , y . length , x , [ ] , y , 1 , out , 2 ) ; // $ExpectError
93- dcartesianProduct ( x . length , y . length , x , { } , y , 1 , out , 2 ) ; // $ExpectError
94- dcartesianProduct ( x . length , y . length , x , ( x : number ) : number => x , y , 1 , out , 2 ) ; // $ExpectError
103+ dcartesianProduct ( 'row-major' , x . length , y . length , x , '10' , y , 1 , out , 2 ) ; // $ExpectError
104+ dcartesianProduct ( 'row-major' , x . length , y . length , x , true , y , 1 , out , 2 ) ; // $ExpectError
105+ dcartesianProduct ( 'row-major' , x . length , y . length , x , false , y , 1 , out , 2 ) ; // $ExpectError
106+ dcartesianProduct ( 'row-major' , x . length , y . length , x , null , y , 1 , out , 2 ) ; // $ExpectError
107+ dcartesianProduct ( 'row-major' , x . length , y . length , x , undefined , y , 1 , out , 2 ) ; // $ExpectError
108+ dcartesianProduct ( 'row-major' , x . length , y . length , x , [ ] , y , 1 , out , 2 ) ; // $ExpectError
109+ dcartesianProduct ( 'row-major' , x . length , y . length , x , { } , y , 1 , out , 2 ) ; // $ExpectError
110+ dcartesianProduct ( 'row-major' , x . length , y . length , x , ( x : number ) : number => x , y , 1 , out , 2 ) ; // $ExpectError
95111}
96112
97- // The compiler throws an error if the function is provided a fifth argument which is not a Float64Array...
113+ // The compiler throws an error if the function is provided a sixth argument which is not a Float64Array...
98114{
99115 const x = new Float64Array ( 2 ) ;
100116 const out = new Float64Array ( 8 ) ;
101117
102- dcartesianProduct ( x . length , 2 , x , 1 , 10 , 1 , out , 2 ) ; // $ExpectError
103- dcartesianProduct ( x . length , 2 , x , 1 , '10' , 1 , out , 2 ) ; // $ExpectError
104- dcartesianProduct ( x . length , 2 , x , 1 , true , 1 , out , 2 ) ; // $ExpectError
105- dcartesianProduct ( x . length , 2 , x , 1 , false , 1 , out , 2 ) ; // $ExpectError
106- dcartesianProduct ( x . length , 2 , x , 1 , null , 1 , out , 2 ) ; // $ExpectError
107- dcartesianProduct ( x . length , 2 , x , 1 , undefined , 1 , out , 2 ) ; // $ExpectError
108- dcartesianProduct ( x . length , 2 , x , 1 , [ ] , 1 , out , 2 ) ; // $ExpectError
109- dcartesianProduct ( x . length , 2 , x , 1 , { } , 1 , out , 2 ) ; // $ExpectError
110- dcartesianProduct ( x . length , 2 , x , 1 , ( x : number ) : number => x , 1 , out , 2 ) ; // $ExpectError
118+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , 10 , 1 , out , 2 ) ; // $ExpectError
119+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , '10' , 1 , out , 2 ) ; // $ExpectError
120+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , true , 1 , out , 2 ) ; // $ExpectError
121+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , false , 1 , out , 2 ) ; // $ExpectError
122+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , null , 1 , out , 2 ) ; // $ExpectError
123+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , undefined , 1 , out , 2 ) ; // $ExpectError
124+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , [ ] , 1 , out , 2 ) ; // $ExpectError
125+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , { } , 1 , out , 2 ) ; // $ExpectError
126+ dcartesianProduct ( 'row-major' , x . length , 2 , x , 1 , ( x : number ) : number => x , 1 , out , 2 ) ; // $ExpectError
111127}
112128
113- // The compiler throws an error if the function is provided a sixth argument which is not a number...
129+ // The compiler throws an error if the function is provided a seventh argument which is not a number...
114130{
115131 const x = new Float64Array ( 2 ) ;
116132 const y = new Float64Array ( 2 ) ;
117133 const out = new Float64Array ( 8 ) ;
118134
119- dcartesianProduct ( x . length , y . length , x , 1 , y , '10' , out , 2 ) ; // $ExpectError
120- dcartesianProduct ( x . length , y . length , x , 1 , y , true , out , 2 ) ; // $ExpectError
121- dcartesianProduct ( x . length , y . length , x , 1 , y , false , out , 2 ) ; // $ExpectError
122- dcartesianProduct ( x . length , y . length , x , 1 , y , null , out , 2 ) ; // $ExpectError
123- dcartesianProduct ( x . length , y . length , x , 1 , y , undefined , out , 2 ) ; // $ExpectError
124- dcartesianProduct ( x . length , y . length , x , 1 , y , [ ] , out , 2 ) ; // $ExpectError
125- dcartesianProduct ( x . length , y . length , x , 1 , y , { } , out , 2 ) ; // $ExpectError
126- dcartesianProduct ( x . length , y . length , x , 1 , y , ( x : number ) : number => x , out , 2 ) ; // $ExpectError
135+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , '10' , out , 2 ) ; // $ExpectError
136+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , true , out , 2 ) ; // $ExpectError
137+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , false , out , 2 ) ; // $ExpectError
138+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , null , out , 2 ) ; // $ExpectError
139+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , undefined , out , 2 ) ; // $ExpectError
140+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , [ ] , out , 2 ) ; // $ExpectError
141+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , { } , out , 2 ) ; // $ExpectError
142+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , ( x : number ) : number => x , out , 2 ) ; // $ExpectError
127143}
128144
129- // The compiler throws an error if the function is provided a seventh argument which is not a Float64Array...
145+ // The compiler throws an error if the function is provided an eighth argument which is not a Float64Array...
130146{
131147 const x = new Float64Array ( 2 ) ;
132148 const y = new Float64Array ( 2 ) ;
133149
134- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , 10 , 2 ) ; // $ExpectError
135- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , '10' , 2 ) ; // $ExpectError
136- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , true , 2 ) ; // $ExpectError
137- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , false , 2 ) ; // $ExpectError
138- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , null , 2 ) ; // $ExpectError
139- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , undefined , 2 ) ; // $ExpectError
140- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , [ ] , 2 ) ; // $ExpectError
141- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , { } , 2 ) ; // $ExpectError
142- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , ( x : number ) : number => x , 2 ) ; // $ExpectError
150+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , 10 , 2 ) ; // $ExpectError
151+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , '10' , 2 ) ; // $ExpectError
152+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , true , 2 ) ; // $ExpectError
153+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , false , 2 ) ; // $ExpectError
154+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , null , 2 ) ; // $ExpectError
155+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , undefined , 2 ) ; // $ExpectError
156+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , [ ] , 2 ) ; // $ExpectError
157+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , { } , 2 ) ; // $ExpectError
158+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , ( x : number ) : number => x , 2 ) ; // $ExpectError
143159}
144160
145- // The compiler throws an error if the function is provided an eighth argument which is not a number...
161+ // The compiler throws an error if the function is provided a ninth argument which is not a number...
146162{
147163 const x = new Float64Array ( 2 ) ;
148164 const y = new Float64Array ( 2 ) ;
149165 const out = new Float64Array ( 8 ) ;
150166
151- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , '10' ) ; // $ExpectError
152- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , true ) ; // $ExpectError
153- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , false ) ; // $ExpectError
154- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , null ) ; // $ExpectError
155- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , undefined ) ; // $ExpectError
156- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , [ ] ) ; // $ExpectError
157- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , { } ) ; // $ExpectError
158- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , ( x : number ) : number => x ) ; // $ExpectError
167+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , '10' ) ; // $ExpectError
168+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , true ) ; // $ExpectError
169+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , false ) ; // $ExpectError
170+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , null ) ; // $ExpectError
171+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , undefined ) ; // $ExpectError
172+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , [ ] ) ; // $ExpectError
173+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , { } ) ; // $ExpectError
174+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , ( x : number ) : number => x ) ; // $ExpectError
159175}
160176
161177// The compiler throws an error if the function is provided an unsupported number of arguments...
@@ -165,14 +181,15 @@ import dcartesianProduct = require( './index' );
165181 const out = new Float64Array ( 8 ) ;
166182
167183 dcartesianProduct ( ) ; // $ExpectError
168- dcartesianProduct ( x . length ) ; // $ExpectError
169- dcartesianProduct ( x . length , y . length ) ; // $ExpectError
170- dcartesianProduct ( x . length , y . length , x ) ; // $ExpectError
171- dcartesianProduct ( x . length , y . length , x , 1 ) ; // $ExpectError
172- dcartesianProduct ( x . length , y . length , x , 1 , y ) ; // $ExpectError
173- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 ) ; // $ExpectError
174- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out ) ; // $ExpectError
175- dcartesianProduct ( x . length , y . length , x , 1 , y , 1 , out , 2 , 1 ) ; // $ExpectError
184+ dcartesianProduct ( 'row-major' ) ; // $ExpectError
185+ dcartesianProduct ( 'row-major' , x . length ) ; // $ExpectError
186+ dcartesianProduct ( 'row-major' , x . length , y . length ) ; // $ExpectError
187+ dcartesianProduct ( 'row-major' , x . length , y . length , x ) ; // $ExpectError
188+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 ) ; // $ExpectError
189+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y ) ; // $ExpectError
190+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 ) ; // $ExpectError
191+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out ) ; // $ExpectError
192+ dcartesianProduct ( 'row-major' , x . length , y . length , x , 1 , y , 1 , out , 2 , 1 ) ; // $ExpectError
176193}
177194
178195// Attached to main export is an `ndarray` method which returns a Float64Array...
0 commit comments