Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions lib/node_modules/@stdlib/blas/ext/base/gfill-rows/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 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';

/**
* Fill the rows of a matrix from a vector of fill values.
*
* @module @stdlib/blas/ext/base/gfill-rows
*
* @example
* var gfillRows = require( '@stdlib/blas/ext/base/gfill-rows' );
*
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
var main = require( './main.js' );
var ndarray = require( './ndarray.js' );


// MAIN //

setReadOnly( main, 'ndarray', ndarray );


// EXPORTS //

module.exports = main;
80 changes: 80 additions & 0 deletions lib/node_modules/@stdlib/blas/ext/base/gfill-rows/lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 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 isLayout = require( '@stdlib/blas/base/assert/is-layout' );
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
var format = require( '@stdlib/string/format' );
var max = require( '@stdlib/math/base/special/fast/max' );
var ndarray = require( './ndarray.js' );


// MAIN //

/**
* Fills the rows of a matrix from a vector of fill values.
*
* @param {string} order - storage layout
* @param {integer} M - number of rows in `A`
* @param {integer} N - number of columns in `A`
* @param {Collection} alpha - vector containing fill values
* @param {Collection} A - input matrix
* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
* @throws {TypeError} first argument must be a valid order
* @throws {RangeError} seventh argument must be greater than or equal to max(1,M) for column-major or max(1,N) for row-major
* @returns {Collection} input matrix
*
* @example
* var alpha = [ 10.0, 20.0 ];
* var A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
*
* gfillRows( 'row-major', 2, 3, alpha, A, 3 );
* // A => [ 10.0, 10.0, 10.0, 20.0, 20.0, 20.0 ]
*/
function gfillRows( order, M, N, alpha, A, LDA ) {
var strideA1;
var strideA2;
var s;

if ( !isLayout( order ) ) {
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
}

if ( isColumnMajor( order ) ) {
s = M;
strideA1 = 1;
strideA2 = LDA;
} else { // order === 'row-major'
s = N;
strideA1 = LDA;
strideA2 = 1;
}
if ( LDA < max( 1, s ) ) {
throw new RangeError( format( 'invalid argument. Seventh argument must be greater than or equal to max(1,%d). Value: `%d`.', s, LDA ) );
}

return ndarray( M, N, alpha, 1, 0, A, strideA1, strideA2, 0 );
}


// EXPORTS //

module.exports = gfillRows;
74 changes: 74 additions & 0 deletions lib/node_modules/@stdlib/blas/ext/base/gfill-rows/lib/ndarray.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2026 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 gfill = require( '@stdlib/blas/ext/base/gfill' ).ndarray;


// MAIN //

/**
* Fills the rows of a matrix from a vector of fill values.
*
* @param {integer} M - number of rows in `A`
* @param {integer} N - number of columns in `A`
* @param {Collection} alpha - vector of fill values
* @param {integer} strideAlpha - stride length of `alpha`
* @param {NonNegativeInteger} offsetAlpha - starting index for `alpha`
* @param {Collection} A - input matrix
* @param {integer} strideA1 - stride length for the first dimension of `A`
* @param {integer} strideA2 - stride length for the second dimension of `A`
* @param {NonNegativeInteger} offsetA - starting index for `A`
* @returns {Collection} input matrix
*
* @example
* var alpha = [ 10.0, 20.0 ];
* var A = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
*
* gfillRows( 2, 3, alpha, 1, 0, A, 3, 1, 0 );
* // A => [ 10.0, 10.0, 10.0, 20.0, 20.0, 20.0 ]
*/
function gfillRows( M, N, alpha, strideAlpha, offsetAlpha, A, strideA1, strideA2, offsetA ) {

Check warning on line 49 in lib/node_modules/@stdlib/blas/ext/base/gfill-rows/lib/ndarray.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

This line has a length of 93. Maximum allowed is 80
var ia;
var ix;
var i;

if ( M <= 0 || N <= 0 ) {
return A;
}

// TODO: Column-major

Check warning on line 58 in lib/node_modules/@stdlib/blas/ext/base/gfill-rows/lib/ndarray.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: Column-major'

// Row-major
ia = offsetAlpha;
for ( i = 0; i < M; i++ ) {
ix = offsetA + (i * strideA1);
gfill( N, alpha[ ia ], A, strideA2, ix);
ia += strideAlpha;
}

return A;
}


// EXPORTS //

module.exports = gfillRows;
69 changes: 69 additions & 0 deletions lib/node_modules/@stdlib/blas/ext/base/gfill-rows/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "@stdlib/blas/ext/base/gfill-rows",
"version": "0.0.0",
"description": "Fill the rows of a matrix from a vector of fill values.",
"license": "Apache-2.0",
"author": {
"name": "The Stdlib Authors",
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
},
"contributors": [
{
"name": "The Stdlib Authors",
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
}
],
"main": "./lib",
"directories": {
"benchmark": "./benchmark",
"doc": "./docs",
"example": "./examples",
"lib": "./lib",
"test": "./test"
},
"types": "./docs/types",
"scripts": {},
"homepage": "https://github.com/stdlib-js/stdlib",
"repository": {
"type": "git",
"url": "git://github.com/stdlib-js/stdlib.git"
},
"bugs": {
"url": "https://github.com/stdlib-js/stdlib/issues"
},
"dependencies": {},
"devDependencies": {},
"engines": {
"node": ">=0.10.0",
"npm": ">2.7.0"
},
"os": [
"aix",
"darwin",
"freebsd",
"linux",
"macos",
"openbsd",
"sunos",
"win32",
"windows"
],
"keywords": [
"stdlib",
"stdmath",
"mathematics",
"math",
"blas",
"extended",
"fill",
"row",
"assign",
"set",
"matrix",
"constant",
"strided",
"array",
"ndarray"
],
"__stdlib__": {}
}
Loading