@@ -121,6 +121,7 @@ import numel = require( './../../../base/numel' );
121121import numelDimension = require( './../../../base/numel-dimension' ) ;
122122import offset = require( './../../../base/offset' ) ;
123123import ones = require( './../../../base/ones' ) ;
124+ import onesLike = require( './../../../base/ones-like' ) ;
124125import order = require( './../../../base/order' ) ;
125126import outputDataType = require( './../../../base/output-dtype' ) ;
126127import outputPolicyEnum2Str = require( './../../../base/output-policy-enum2str' ) ;
@@ -3183,6 +3184,37 @@ interface Namespace {
31833184 */
31843185 ones : typeof ones ;
31853186
3187+ /**
3188+ * Creates a ones-filled array having the same shape and data type as a provided input ndarray.
3189+ *
3190+ * @param x - input array
3191+ * @returns ones-filled array
3192+ *
3193+ * @example
3194+ * var getShape = require( './../../../shape' );
3195+ * var getDType = require( './../../../dtype' );
3196+ * var ones = require( './../../../base/ones' );
3197+ *
3198+ * var x = ones( 'float64', [ 2, 2 ], 'row-major' );
3199+ * // returns <ndarray>[ [ 1.0, 1.0 ], [ 1.0, 1.0 ] ]
3200+ *
3201+ * var sh = getShape( x );
3202+ * // returns [ 2, 2 ]
3203+ *
3204+ * var dt = String( getDType( x ) );
3205+ * // returns 'float64'
3206+ *
3207+ * var y = ns.onesLike( x );
3208+ * // returns <ndarray>[ [ 1.0, 1.0 ], [ 1.0, 1.0 ] ]
3209+ *
3210+ * sh = getShape( y );
3211+ * // returns [ 2, 2 ]
3212+ *
3213+ * dt = String( getDType( y ) );
3214+ * // returns 'float64'
3215+ */
3216+ onesLike : typeof onesLike ;
3217+
31863218 /**
31873219 * Returns the layout order of a provided ndarray.
31883220 *
@@ -5435,23 +5467,23 @@ interface Namespace {
54355467 * var getDType = require( './../../../dtype' );
54365468 * var zeros = require( './../../../base/zeros' );
54375469 *
5438- * var x = zeros( 'generic ', [ 2, 2 ], 'row-major' );
5439- * // returns <ndarray>[ [ 0, 0 ], [ 0, 0 ] ]
5470+ * var x = zeros( 'float64 ', [ 2, 2 ], 'row-major' );
5471+ * // returns <ndarray>[ [ 0.0 , 0.0 ], [ 0.0, 0. 0 ] ]
54405472 *
54415473 * var sh = getShape( x );
54425474 * // returns [ 2, 2 ]
54435475 *
54445476 * var dt = String( getDType( x ) );
5445- * // returns 'generic '
5477+ * // returns 'float64 '
54465478 *
54475479 * var y = ns.zerosLike( x );
5448- * // returns <ndarray>[ [ 0, 0 ], [ 0, 0 ] ]
5480+ * // returns <ndarray>[ [ 0.0 , 0.0 ], [ 0.0, 0. 0 ] ]
54495481 *
54505482 * sh = getShape( y );
54515483 * // returns [ 2, 2 ]
54525484 *
54535485 * dt = String( getDType( y ) );
5454- * // returns 'generic '
5486+ * // returns 'float64 '
54555487 */
54565488 zerosLike : typeof zerosLike ;
54575489
0 commit comments