-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
549e015
commit 999c6f8
Showing
2 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |