You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/ext/join/README.md
+51-12Lines changed: 51 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ limitations under the License.
20
20
21
21
# join
22
22
23
-
> Return an [ndarray][@stdlib/ndarray/ctor] created by joining elements using a specified separator along an [ndarray][@stdlib/ndarray/ctor] dimension.
23
+
> Return an [ndarray][@stdlib/ndarray/ctor] created by joining elements using a separator along an [ndarray][@stdlib/ndarray/ctor] dimension.
24
24
25
25
<sectionclass="usage">
26
26
@@ -30,9 +30,9 @@ limitations under the License.
30
30
var join =require( '@stdlib/blas/ext/join' );
31
31
```
32
32
33
-
#### join( x, separator\[, options] )
33
+
#### join( x\[, options] )
34
34
35
-
Returns an [ndarray][@stdlib/ndarray/ctor] created by joining elements using a specified separator along an [ndarray][@stdlib/ndarray/ctor] dimension.
35
+
Returns an [ndarray][@stdlib/ndarray/ctor] created by joining elements using a separator along an [ndarray][@stdlib/ndarray/ctor] dimension.
36
36
37
37
```javascript
38
38
var array =require( '@stdlib/ndarray/array' );
@@ -42,7 +42,7 @@ var x = array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
42
42
// returns <ndarray>
43
43
44
44
// Perform operation:
45
-
var out =join( x, ',' );
45
+
var out =join( x );
46
46
// returns <ndarray>
47
47
48
48
var v =out.get();
@@ -52,14 +52,31 @@ var v = out.get();
52
52
The function has the following parameters:
53
53
54
54
-**x**: input [ndarray][@stdlib/ndarray/ctor]. Must have at least one dimension.
55
-
-**separator**: separator. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] with generic [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, the separator [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`.
56
55
-**options**: function options (_optional_).
57
56
58
57
The function accepts the following options:
59
58
59
+
-**separator**: separator. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] with generic [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, the separator [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. Default: `,`.
60
60
-**dim**: dimension over which to perform operation. If provided a negative integer, the dimension along which to perform the operation is determined by counting backward from the last dimension (where `-1` refers to the last dimension). Default: `-1`.
61
61
-**keepdims**: boolean indicating whether the reduced dimensions should be included in the returned [ndarray][@stdlib/ndarray/ctor] as singleton dimensions. Default: `false`.
62
62
63
+
By default, the function uses `,` as a separator. To perform the operation with a different separator, provide a `separator` option.
64
+
65
+
```javascript
66
+
var ndarray2array =require( '@stdlib/ndarray/to-array' );
67
+
var array =require( '@stdlib/ndarray/array' );
68
+
69
+
var x =array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
70
+
71
+
var out =join( x, {
72
+
'separator':'|'
73
+
});
74
+
// returns <ndarray>
75
+
76
+
var v =out.get();
77
+
// returns '1|2|3|4|5|6'
78
+
```
79
+
63
80
By default, the function performs the operation over elements in the last dimension. To perform the operation over a different dimension, provide a `dim` option.
64
81
65
82
```javascript
@@ -68,7 +85,7 @@ var array = require( '@stdlib/ndarray/array' );
68
85
69
86
var x =array( [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] );
70
87
71
-
var out =join( x, ',', {
88
+
var out =join( x, {
72
89
'dim':0
73
90
});
74
91
// returns <ndarray>
@@ -90,16 +107,16 @@ var opts = {
90
107
'keepdims':true
91
108
};
92
109
93
-
var out =join( x, ',', opts );
110
+
var out =join( x, opts );
94
111
// returns <ndarray>
95
112
96
113
var v =ndarray2array( out );
97
114
// returns [ [ '1,3', '2,4' ] ]
98
115
```
99
116
100
-
#### join.assign( x, separator, out\[, options] )
117
+
#### join.assign( x, out\[, options] )
101
118
102
-
Joins elements of an input [ndarray][@stdlib/ndarray/ctor] using a specified separator along an [ndarray][@stdlib/ndarray/ctor] dimension and assigns results to a provided output [ndarray][@stdlib/ndarray/ctor].
119
+
Joins elements of an input [ndarray][@stdlib/ndarray/ctor] using a separator along an [ndarray][@stdlib/ndarray/ctor] dimension and assigns results to a provided output [ndarray][@stdlib/ndarray/ctor].
103
120
104
121
```javascript
105
122
var array =require( '@stdlib/ndarray/array' );
@@ -112,7 +129,7 @@ var y = empty( [], {
112
129
'dtype':'generic'
113
130
});
114
131
115
-
var out =join.assign( x, ',', y );
132
+
var out =join.assign( x, y );
116
133
// returns <ndarray>
117
134
118
135
var v =out.get();
@@ -125,14 +142,36 @@ var bool = ( out === y );
125
142
The method has the following parameters:
126
143
127
144
-**x**: input [ndarray][@stdlib/ndarray/ctor]. Must have at least one dimension.
128
-
-**separator**: separator. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] with generic [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, the separator [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`.
129
145
-**out**: output [ndarray][@stdlib/ndarray/ctor].
130
146
-**options**: function options (_optional_).
131
147
132
148
The method accepts the following options:
133
149
150
+
-**separator**: separator. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] with generic [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, the separator [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`.
134
151
-**dim**: dimension over which to perform operation. If provided a negative integer, the dimension along which to perform the operation is determined by counting backward from the last dimension (where `-1` refers to the last dimension). Default: `-1`.
135
152
153
+
```javascript
154
+
var ndarray2array =require( '@stdlib/ndarray/to-array' );
155
+
var empty =require( '@stdlib/ndarray/empty' );
156
+
var array =require( '@stdlib/ndarray/array' );
157
+
158
+
var x =array( [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] );
159
+
var y =empty( [ 2 ], {
160
+
'dtype':'generic'
161
+
});
162
+
163
+
var out =join.assign( x, y, {
164
+
'dim':0
165
+
});
166
+
// returns <ndarray>
167
+
168
+
var v =ndarray2array( y );
169
+
// returns [ '1,3', '2,4' ]
170
+
171
+
var bool = ( out === y );
172
+
// returns true
173
+
```
174
+
136
175
</section>
137
176
138
177
<!-- /.usage -->
@@ -169,7 +208,7 @@ var x = new ndarray( 'float64', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
0 commit comments