Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Jul 18, 2023
1 parent 549e015 commit 999c6f8
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 10 deletions.
20 changes: 10 additions & 10 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@
# Contributors listed in alphabetical order.

Ali Salesi <[email protected]>
Amit Jimiwal <[email protected]>
Athan Reines <[email protected]>
Brendan Graetz <[email protected]>
Bruno Fenzl <[email protected]>
Christopher Dambamuromo <[email protected]>
Dominik Moritz <[email protected]>
Dorrin Sotoudeh <[email protected]>
Frank Kovacs <[email protected]>
Harshita Kalani <[email protected].com>
James <[email protected]>
Harshita Kalani <harshitakalani02@gmail.com>
James Gelok <[email protected]>
Jithin KS <[email protected]>
Joey Reed <[email protected]>
Jordan-Gallivan <[email protected]>
Jordan Gallivan <[email protected]>
Joris Labie <[email protected]>
Justin Dennison <[email protected]>
KATTA NAGA NITHIN <[email protected]>
Marcus <[email protected]>
Marcus Fantham <[email protected]>
Matt Cochrane <[email protected]>
Milan Raj <[email protected]>
Momtchil Momtchev <[email protected]>
Naresh Jagadeesan <[email protected]>
Naresh Jagadeesan <[email protected]>
Nithin Katta <[email protected]>
Ognjen Jevremović <[email protected]>
Philipp Burckhardt <[email protected]>
Pranav <[email protected]>
Pranav Goswami <[email protected]>
Ricky Reusser <[email protected]>
Roman Stetsyk <[email protected]>
Ryan Seal <[email protected]>
Seyyed Parsa Neshaei <[email protected]>
Shraddheya Shendre <[email protected]>
Stephannie Jiménez Gacha <[email protected]>
Yernar Yergaziyev <[email protected]>
dorrin-sot <[email protected]>
drunken_devv <[email protected]>
orimiles5 <[email protected]>
rei2hu <[email protected]>
rei2hu <[email protected]>
76 changes: 76 additions & 0 deletions dispatch-by/test/fixtures/fill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2023 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var ind2sub = require( './../../../ind2sub' );
var numel = require( './../../../base/numel' );


// MAIN //

/**
* Return an ndarray function which fills one or more ndarrays.
*
* @private
* @param {*} value - fill value
* @returns {Function} ndarray function
*/
function fill( value ) {
return ndarrayFcn;

/**
* ndarray function.
*
* @private
* @param {Array<ndarrayLike>} arrays - ndarrays
*/
function ndarrayFcn( arrays ) {
var opts;
var sub;
var arr;
var sh;
var M;
var N;
var i;
var j;

sh = arrays[ 0 ].shape;
N = numel( sh );
M = arrays.length;
opts = {
'order': ''
};
for ( j = 0; j < M; j++ ) {
arr = arrays[ j ];
opts.order = arrays[ j ].order;
for ( i = 0; i < N; i++ ) {
sub = ind2sub( sh, i, opts );
sub.push( value );
arr.set.apply( arr, sub );
}
}
}
}


// EXPORTS //

module.exports = fill;

0 comments on commit 999c6f8

Please sign in to comment.