@stdlib/lapack-base-dlaswp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2024 The Stdlib Authors.
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md CHANGED
@@ -35,7 +35,17 @@ limitations under the License.
35
35
 
36
36
  > Perform a series of row interchanges on an input matrix.
37
37
 
38
- <section class = "usage">
38
+ <section class="installation">
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ npm install @stdlib/lapack-base-dlaswp
44
+ ```
45
+
46
+ </section>
47
+
48
+ <section class="usage">
39
49
 
40
50
  ## Usage
41
51
 
@@ -45,7 +55,7 @@ var dlaswp = require( '@stdlib/lapack-base-dlaswp' );
45
55
 
46
56
  #### dlaswp( N, A, LDA, k1, k2, IPIV, incx )
47
57
 
48
- Perform a series of row interchanges on an input matrix `A` using pivot indices stored in `IPIV`.
58
+ Performs a series of row interchanges on an input matrix `A` using pivot indices stored in `IPIV`.
49
59
 
50
60
  ```javascript
51
61
  var Int32Array = require( '@stdlib/array-int32' );
@@ -169,7 +179,7 @@ dlaswp.ndarray( 2, A, 2, 1, 4, 0, 2, 1, IPIV, 1, 2 );
169
179
 
170
180
  - Both functions access `k2-k1+1` elements from `IPIV`.
171
181
  - While `dlaswp` conflates the order in which pivots are applied with the order in which elements in `IPIV` are accessed, the `ndarray` method delineates control of those behaviors with separate parameters `inck` and `si`.
172
- - `dlaswp()` corresponds to the [LAPACK][LAPACK] level 1 function [`dlaswp`][lapack-dlaswp].
182
+ - `dlaswp()` corresponds to the [LAPACK][LAPACK] function [`dlaswp`][lapack-dlaswp].
173
183
 
174
184
  </section>
175
185
 
@@ -227,16 +237,6 @@ console.log( ndarray2array( A, shape, strides, offset, order ) );
227
237
 
228
238
  <!-- C usage documentation. -->
229
239
 
230
- <section class="installation">
231
-
232
- ## Installation
233
-
234
- ```bash
235
- npm install @stdlib/lapack-base-dlaswp
236
- ```
237
-
238
- </section>
239
-
240
240
  <section class="usage">
241
241
 
242
242
  ### Usage
@@ -323,7 +323,7 @@ See [LICENSE][stdlib-license].
323
323
 
324
324
  ## Copyright
325
325
 
326
- Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
326
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
327
327
 
328
328
  </section>
329
329
 
@@ -336,8 +336,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
336
336
  [npm-image]: http://img.shields.io/npm/v/@stdlib/lapack-base-dlaswp.svg
337
337
  [npm-url]: https://npmjs.org/package/@stdlib/lapack-base-dlaswp
338
338
 
339
- [test-image]: https://github.com/stdlib-js/lapack-base-dlaswp/actions/workflows/test.yml/badge.svg?branch=v0.1.0
340
- [test-url]: https://github.com/stdlib-js/lapack-base-dlaswp/actions/workflows/test.yml?query=branch:v0.1.0
339
+ [test-image]: https://github.com/stdlib-js/lapack-base-dlaswp/actions/workflows/test.yml/badge.svg?branch=v0.2.0
340
+ [test-url]: https://github.com/stdlib-js/lapack-base-dlaswp/actions/workflows/test.yml?query=branch:v0.2.0
341
341
 
342
342
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/lapack-base-dlaswp/main.svg
343
343
  [coverage-url]: https://codecov.io/github/stdlib-js/lapack-base-dlaswp?branch=main
@@ -349,8 +349,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
349
349
 
350
350
  -->
351
351
 
352
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
353
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
352
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
353
+ [chat-url]: https://stdlib.zulipchat.com
354
354
 
355
355
  [stdlib]: https://github.com/stdlib-js/stdlib
356
356
 
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";var R=function(v,r){return function(){return r||v((r={exports:{}}).exports,r),r.exports}};var F=R(function(rr,c){
2
- var H=require('@stdlib/ndarray-base-assert-is-row-major/dist'),J=require('@stdlib/math-base-special-floor/dist'),Q=require('@stdlib/blas-base-dswap/dist').ndarray,_=32;function U(v,r,o,n,a,e,q,u,y,t,m){var i,s,E,w,b,h,f,j,x,l,g,p;if(u>0?i=q-e:i=e-q,i+=1,H([o,n])){for(f=m,j=0,l=e;j<i;j++,l+=u)w=y[f],w!==l&&Q(v,r,n,a+l*o,r,n,a+w*o),f+=t;return r}if(s=J(v/_)*_,s!==0)for(x=0;x<s;x+=_)for(f=m,j=0,l=e;j<i;j++,l+=u){if(w=y[f],w!==l)for(b=a+l*o,h=a+w*o,g=x;g<x+_;g++)p=g*n,E=r[b+p],r[b+p]=r[h+p],r[h+p]=E;f+=t}if(s!==v)for(f=m,j=0,l=e;j<i;j++,l+=u){if(w=y[f],w!==l)for(b=a+l*o,h=a+w*o,g=s;g<v;g++)p=g*n,E=r[b+p],r[b+p]=r[h+p],r[h+p]=E;f+=t}return r}c.exports=U
3
- });var K=R(function(ar,C){
4
- var W=require('@stdlib/blas-base-assert-is-layout/dist'),X=require('@stdlib/math-base-special-max/dist'),B=require('@stdlib/error-tools-fmtprodmsg/dist'),Y=F();function $(v,r,o,n,a,e,q,u){var y,t,m,i,s;if(!W(v))throw new TypeError(B('1xhFx',v));if(v==="row-major"&&n<X(1,r))throw new RangeError(B('1xhG4',r,n));if(u>0)t=1,s=a;else if(u<0)t=-1,s=a+(a-e)*u,y=a,a=e,e=y;else return o;return v==="column-major"?(m=1,i=n):(m=n,i=1),Y(r,o,m,i,0,a,e,t,q,u,s)}C.exports=$
5
- });var S=R(function(er,M){
6
- var d=F();function L(v,r,o,n,a,e,q,u,y,t,m){var i;return u<0?(m+=q*t,t*=-1,i=e,e=q,q=i,u=-1):(m+=e*t,u=1),d(v,r,o,n,a,e,q,u,y,t,m)}M.exports=L
7
- });var z=R(function(ur,Z){
8
- var D=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),T=K(),N=S();D(T,"ndarray",N);Z.exports=T
9
- });var V=require("path").join,P=require('@stdlib/utils-try-require/dist'),I=require('@stdlib/assert-is-error/dist'),k=z(),O,G=P(V(__dirname,"./native.js"));I(G)?O=k:O=G;module.exports=O;
1
+ "use strict";var E=function(v,r){return function(){return r||v((r={exports:{}}).exports,r),r.exports}};var _=E(function(er,F){
2
+ var H=require('@stdlib/ndarray-base-assert-is-row-major/dist'),J=require('@stdlib/math-base-special-floor/dist'),Q=require('@stdlib/blas-base-dswap/dist').ndarray,M=32;function U(v,r,o,n,a,e,p,u,y,t,q){var i,m,x,w,R,b,f,j,h,l,g,s;if(u>0?i=p-e:i=e-p,i+=1,H([o,n])){for(f=q,j=0,l=e;j<i;j++,l+=u)w=y[f],w!==l&&Q(v,r,n,a+l*o,r,n,a+w*o),f+=t;return r}if(m=J(v/M)*M,m!==0)for(h=0;h<m;h+=M)for(f=q,j=0,l=e;j<i;j++,l+=u){if(w=y[f],w!==l)for(R=a+l*o,b=a+w*o,g=h;g<h+M;g++)s=g*n,x=r[R+s],r[R+s]=r[b+s],r[b+s]=x;f+=t}if(m!==v)for(f=q,j=0,l=e;j<i;j++,l+=u){if(w=y[f],w!==l)for(R=a+l*o,b=a+w*o,g=m;g<v;g++)s=g*n,x=r[R+s],r[R+s]=r[b+s],r[b+s]=x;f+=t}return r}F.exports=U
3
+ });var K=E(function(ur,B){
4
+ var W=require('@stdlib/blas-base-assert-is-layout/dist'),X=require('@stdlib/ndarray-base-assert-is-row-major-string/dist'),Y=require('@stdlib/ndarray-base-assert-is-column-major-string/dist'),$=require('@stdlib/math-base-special-max/dist'),O=require('@stdlib/error-tools-fmtprodmsg/dist'),d=_();function L(v,r,o,n,a,e,p,u){var y,t,q,i,m;if(!W(v))throw new TypeError(O('1xhFx',v));if(X(v)&&n<$(1,r))throw new RangeError(O('1xhG4',r,n));if(u>0)t=1,m=a;else if(u<0)t=-1,m=a+(a-e)*u,y=a,a=e,e=y;else return o;return Y(v)?(q=1,i=n):(q=n,i=1),d(r,o,q,i,0,a,e,t,p,u,m)}B.exports=L
5
+ });var T=E(function(vr,S){
6
+ var D=_();function N(v,r,o,n,a,e,p,u,y,t,q){var i;return u<0?(q+=p*t,t*=-1,i=e,e=p,p=i,u=-1):(q+=e*t,u=1),D(v,r,o,n,a,e,p,u,y,t,q)}S.exports=N
7
+ });var z=E(function(ir,c){
8
+ var V=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),Z=K(),P=T();V(Z,"ndarray",P);c.exports=Z
9
+ });var I=require("path").join,k=require('@stdlib/utils-try-require/dist'),A=require('@stdlib/assert-is-error/dist'),rr=z(),C,G=k(I(__dirname,"./native.js"));A(G)?C=rr:C=G;module.exports=C;
10
10
  /** @license Apache-2.0 */
11
11
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/base.js", "../lib/dlaswp.js", "../lib/ndarray.js", "../lib/main.js", "../lib/index.js"],
4
- "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isRowMajor = require( '@stdlib/ndarray-base-assert-is-row-major' );\nvar floor = require( '@stdlib/math-base-special-floor' );\nvar dswap = require( '@stdlib/blas-base-dswap' ).ndarray;\n\n\n// VARIABLES //\n\nvar BLOCK_SIZE = 32;\n\n\n// MAIN //\n\n/**\n* Performs a series of row interchanges on a matrix `A` using pivot indices stored in `IPIV`.\n*\n* @private\n* @param {PositiveInteger} N - number of columns in `A`\n* @param {Float64Array} A - input matrix\n* @param {integer} strideA1 - stride of the first dimension of `A`\n* @param {integer} strideA2 - stride of the second dimension of `A`\n* @param {NonNegativeInteger} offsetA - index offset for `A`\n* @param {NonNegativeInteger} k1 - index of first row to interchange\n* @param {NonNegativeInteger} k2 - index of last row to interchange\n* @param {integer} inck - direction in which to apply pivots (-1 to apply pivots in reverse order; otherwise, apply in provided order)\n* @param {Int32Array} IPIV - vector of pivot indices\n* @param {integer} strideIPIV - `IPIV` stride length\n* @param {NonNegativeInteger} offsetIPIV - index offset for `IPIV`\n* @returns {Float64Array} permuted matrix `A`\n*\n* @example\n* var Int32Array = require( '@stdlib/array-int32' );\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var IPIV = new Int32Array( [ 2, 0, 1 ] );\n* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // => [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]\n*\n* dlaswp( 2, A, 2, 1, 0, 0, 2, 1, IPIV, 1, 0 );\n* // A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]\n*/\nfunction dlaswp( N, A, strideA1, strideA2, offsetA, k1, k2, inck, IPIV, strideIPIV, offsetIPIV ) { // eslint-disable-line max-len, max-params\n\tvar nrows;\n\tvar n32;\n\tvar tmp;\n\tvar row;\n\tvar ia1;\n\tvar ia2;\n\tvar ip;\n\tvar i;\n\tvar j;\n\tvar k;\n\tvar n;\n\tvar o;\n\n\t// Compute the number of rows to be interchanged:\n\tif ( inck > 0 ) {\n\t\tnrows = k2 - k1;\n\t} else {\n\t\tnrows = k1 - k2;\n\t}\n\tnrows += 1;\n\n\t// If the order is row-major, we can delegate to the Level 1 routine `dswap` for interchanging rows...\n\tif ( isRowMajor( [ strideA1, strideA2 ] ) ) {\n\t\tip = offsetIPIV;\n\t\tfor ( i = 0, k = k1; i < nrows; i++, k += inck ) {\n\t\t\trow = IPIV[ ip ];\n\t\t\tif ( row !== k ) {\n\t\t\t\tdswap( N, A, strideA2, offsetA+(k*strideA1), A, strideA2, offsetA+(row*strideA1) ); // eslint-disable-line max-len\n\t\t\t}\n\t\t\tip += strideIPIV;\n\t\t}\n\t\treturn A;\n\t}\n\t// If the order is column-major, we need to use loop tiling to ensure efficient cache access when accessing matrix elements...\n\tn32 = floor( N/BLOCK_SIZE ) * BLOCK_SIZE;\n\tif ( n32 !== 0 ) {\n\t\tfor ( j = 0; j < n32; j += BLOCK_SIZE ) {\n\t\t\tip = offsetIPIV;\n\t\t\tfor ( i = 0, k = k1; i < nrows; i++, k += inck ) {\n\t\t\t\trow = IPIV[ ip ];\n\t\t\t\tif ( row !== k ) {\n\t\t\t\t\tia1 = offsetA + ( k*strideA1 );\n\t\t\t\t\tia2 = offsetA + ( row*strideA1 );\n\t\t\t\t\tfor ( n = j; n < j+BLOCK_SIZE; n++ ) {\n\t\t\t\t\t\to = n * strideA2;\n\t\t\t\t\t\ttmp = A[ ia1+o ];\n\t\t\t\t\t\tA[ ia1+o ] = A[ ia2+o ];\n\t\t\t\t\t\tA[ ia2+o ] = tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tip += strideIPIV;\n\t\t\t}\n\t\t}\n\t}\n\tif ( n32 !== N ) {\n\t\tip = offsetIPIV;\n\t\tfor ( i = 0, k = k1; i < nrows; i++, k += inck ) {\n\t\t\trow = IPIV[ ip ];\n\t\t\tif ( row !== k ) {\n\t\t\t\tia1 = offsetA + ( k*strideA1 );\n\t\t\t\tia2 = offsetA + ( row*strideA1 );\n\t\t\t\tfor ( n = n32; n < N; n++ ) {\n\t\t\t\t\to = n * strideA2;\n\t\t\t\t\ttmp = A[ ia1+o ];\n\t\t\t\t\tA[ ia1+o ] = A[ ia2+o ];\n\t\t\t\t\tA[ ia2+o ] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\tip += strideIPIV;\n\t\t}\n\t}\n\treturn A;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isLayout = require( '@stdlib/blas-base-assert-is-layout' );\nvar max = require( '@stdlib/math-base-special-max' );\nvar format = require( '@stdlib/string-format' );\nvar base = require( './base.js' );\n\n\n// MAIN //\n\n/**\n* Performs a series of row interchanges on a matrix `A` using pivot indices stored in `IPIV`.\n*\n* @param {string} order - storage layout\n* @param {PositiveInteger} N - number of columns in `A`\n* @param {Float64Array} A - input matrix\n* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)\n* @param {NonNegativeInteger} k1 - index of first row to interchange\n* @param {NonNegativeInteger} k2 - index of last row to interchange\n* @param {Int32Array} IPIV - vector of pivot indices\n* @param {integer} incx - increment between successive values of `IPIV`\n* @throws {TypeError} first argument must be a valid order\n* @throws {RangeError} fourth argument must be greater than or equal to max(1,N)\n* @returns {Float64Array} permuted matrix `A`\n*\n* @example\n* var Int32Array = require( '@stdlib/array-int32' );\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var IPIV = new Int32Array( [ 2, 0, 1 ] );\n* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // => [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]\n*\n* dlaswp( 'row-major', 2, A, 2, 0, 2, IPIV, 1 );\n* // A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]\n*/\nfunction dlaswp( order, N, A, LDA, k1, k2, IPIV, incx ) {\n\tvar tmp;\n\tvar inc;\n\tvar sa1;\n\tvar sa2;\n\tvar io;\n\tif ( !isLayout( order ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );\n\t}\n\tif ( order === 'row-major' && LDA < max( 1, N ) ) {\n\t\tthrow new RangeError( format( 'invalid argument. Fourth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) );\n\t}\n\tif ( incx > 0 ) {\n\t\tinc = 1;\n\t\tio = k1;\n\t} else if ( incx < 0 ) {\n\t\tinc = -1;\n\t\tio = k1 + ( (k1-k2) * incx );\n\t\ttmp = k1;\n\t\tk1 = k2;\n\t\tk2 = tmp;\n\t} else {\n\t\treturn A;\n\t}\n\tif ( order === 'column-major' ) {\n\t\tsa1 = 1;\n\t\tsa2 = LDA;\n\t} else { // order === 'row-major'\n\t\tsa1 = LDA;\n\t\tsa2 = 1;\n\t}\n\treturn base( N, A, sa1, sa2, 0, k1, k2, inc, IPIV, incx, io );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar base = require( './base.js' );\n\n\n// MAIN //\n\n/**\n* Performs a series of row interchanges on a matrix `A` using pivot indices stored in `IPIV`.\n*\n* @param {PositiveInteger} N - number of columns in `A`\n* @param {Float64Array} A - input matrix\n* @param {integer} strideA1 - stride of the first dimension of `A`\n* @param {integer} strideA2 - stride of the second dimension of `A`\n* @param {NonNegativeInteger} offsetA - index offset for `A`\n* @param {NonNegativeInteger} k1 - index of first row to interchange\n* @param {NonNegativeInteger} k2 - index of last row to interchange\n* @param {integer} inck - direction in which to apply pivots (-1 to apply pivots in reverse order; otherwise, apply in provided order)\n* @param {Int32Array} IPIV - vector of pivot indices\n* @param {integer} strideIPIV - `IPIV` stride length\n* @param {NonNegativeInteger} offsetIPIV - index offset for `IPIV`\n* @returns {Float64Array} permuted matrix `A`\n*\n* @example\n* var Int32Array = require( '@stdlib/array-int32' );\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var IPIV = new Int32Array( [ 2, 0, 1 ] );\n* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // => [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]\n*\n* dlaswp( 2, A, 2, 1, 0, 0, 2, 1, IPIV, 1, 0 );\n* // A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]\n*/\nfunction dlaswp( N, A, strideA1, strideA2, offsetA, k1, k2, inck, IPIV, strideIPIV, offsetIPIV ) { // eslint-disable-line max-len, max-params\n\tvar tmp;\n\tif ( inck < 0 ) {\n\t\toffsetIPIV += k2 * strideIPIV;\n\t\tstrideIPIV *= -1;\n\t\ttmp = k1;\n\t\tk1 = k2;\n\t\tk2 = tmp;\n\t\tinck = -1;\n\t} else {\n\t\toffsetIPIV += k1 * strideIPIV;\n\t\tinck = 1;\n\t}\n\treturn base( N, A, strideA1, strideA2, offsetA, k1, k2, inck, IPIV, strideIPIV, offsetIPIV ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dlaswp = require( './dlaswp.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dlaswp, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* LAPACK routine to perform a series of row interchanges on an input matrix.\n*\n* @module @stdlib/lapack-base-dlaswp\n*\n* @example\n* var Int32Array = require( '@stdlib/array-int32' );\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dlaswp = require( '@stdlib/lapack-base-dlaswp' );\n*\n* var IPIV = new Int32Array( [ 2, 0, 1 ] );\n* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // => [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]\n*\n* dlaswp( 'row-major', 2, A, 2, 0, 2, IPIV, 1 );\n* // A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dlaswp;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif ( isError( tmp ) ) {\n\tdlaswp = main;\n} else {\n\tdlaswp = tmp;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n"],
5
- "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,0CAA2C,EACjEC,EAAQ,QAAS,iCAAkC,EACnDC,EAAQ,QAAS,yBAA0B,EAAE,QAK7CC,EAAa,GAgCjB,SAASC,EAAQC,EAAGC,EAAGC,EAAUC,EAAUC,EAASC,EAAIC,EAAIC,EAAMC,EAAMC,EAAYC,EAAa,CAChG,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAWJ,GARKf,EAAO,EACXI,EAAQL,EAAKD,EAEbM,EAAQN,EAAKC,EAEdK,GAAS,EAGJhB,EAAY,CAAEO,EAAUC,CAAS,CAAE,EAAI,CAE3C,IADAc,EAAKP,EACCQ,EAAI,EAAGE,EAAIf,EAAIa,EAAIP,EAAOO,IAAKE,GAAKb,EACzCO,EAAMN,EAAMS,CAAG,EACVH,IAAQM,GACZvB,EAAOG,EAAGC,EAAGE,EAAUC,EAASgB,EAAElB,EAAWD,EAAGE,EAAUC,EAASU,EAAIZ,CAAU,EAElFe,GAAMR,EAEP,OAAOR,CACR,CAGA,GADAW,EAAMhB,EAAOI,EAAEF,CAAW,EAAIA,EACzBc,IAAQ,EACZ,IAAMO,EAAI,EAAGA,EAAIP,EAAKO,GAAKrB,EAE1B,IADAmB,EAAKP,EACCQ,EAAI,EAAGE,EAAIf,EAAIa,EAAIP,EAAOO,IAAKE,GAAKb,EAAO,CAEhD,GADAO,EAAMN,EAAMS,CAAG,EACVH,IAAQM,EAGZ,IAFAL,EAAMX,EAAYgB,EAA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N", "A", "strideA1", "strideA2", "offsetA", "k1", "k2", "inck", "IPIV", "strideIPIV", "offsetIPIV", "nrows", "n32", "tmp", "row", "ia1", "ia2", "ip", "i", "j", "k", "n", "o", "require_dlaswp", "__commonJSMin", "exports", "module", "isLayout", "max", "format", "base", "dlaswp", "order", "N", "A", "LDA", "k1", "k2", "IPIV", "incx", "tmp", "inc", "sa1", "sa2", "io", "require_ndarray", "__commonJSMin", "exports", "module", "base", "dlaswp", "N", "A", "strideA1", "strideA2", "offsetA", "k1", "k2", "inck", "IPIV", "strideIPIV", "offsetIPIV", "tmp", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dlaswp", "ndarray", "join", "tryRequire", "isError", "main", "dlaswp", "tmp"]
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isRowMajor = require( '@stdlib/ndarray-base-assert-is-row-major' );\nvar floor = require( '@stdlib/math-base-special-floor' );\nvar dswap = require( '@stdlib/blas-base-dswap' ).ndarray;\n\n\n// VARIABLES //\n\nvar BLOCK_SIZE = 32;\n\n\n// MAIN //\n\n/**\n* Performs a series of row interchanges on a matrix `A` using pivot indices stored in `IPIV`.\n*\n* @private\n* @param {PositiveInteger} N - number of columns in `A`\n* @param {Float64Array} A - input matrix\n* @param {integer} strideA1 - stride of the first dimension of `A`\n* @param {integer} strideA2 - stride of the second dimension of `A`\n* @param {NonNegativeInteger} offsetA - index offset for `A`\n* @param {NonNegativeInteger} k1 - index of first row to interchange\n* @param {NonNegativeInteger} k2 - index of last row to interchange\n* @param {integer} inck - direction in which to apply pivots (-1 to apply pivots in reverse order; otherwise, apply in provided order)\n* @param {Int32Array} IPIV - vector of pivot indices\n* @param {integer} strideIPIV - `IPIV` stride length\n* @param {NonNegativeInteger} offsetIPIV - index offset for `IPIV`\n* @returns {Float64Array} permuted matrix `A`\n*\n* @example\n* var Int32Array = require( '@stdlib/array-int32' );\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var IPIV = new Int32Array( [ 2, 0, 1 ] );\n* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // => [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]\n*\n* dlaswp( 2, A, 2, 1, 0, 0, 2, 1, IPIV, 1, 0 );\n* // A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]\n*/\nfunction dlaswp( N, A, strideA1, strideA2, offsetA, k1, k2, inck, IPIV, strideIPIV, offsetIPIV ) { // eslint-disable-line max-len, max-params\n\tvar nrows;\n\tvar n32;\n\tvar tmp;\n\tvar row;\n\tvar ia1;\n\tvar ia2;\n\tvar ip;\n\tvar i;\n\tvar j;\n\tvar k;\n\tvar n;\n\tvar o;\n\n\t// Compute the number of rows to be interchanged:\n\tif ( inck > 0 ) {\n\t\tnrows = k2 - k1;\n\t} else {\n\t\tnrows = k1 - k2;\n\t}\n\tnrows += 1;\n\n\t// If the order is row-major, we can delegate to the Level 1 routine `dswap` for interchanging rows...\n\tif ( isRowMajor( [ strideA1, strideA2 ] ) ) {\n\t\tip = offsetIPIV;\n\t\tfor ( i = 0, k = k1; i < nrows; i++, k += inck ) {\n\t\t\trow = IPIV[ ip ];\n\t\t\tif ( row !== k ) {\n\t\t\t\tdswap( N, A, strideA2, offsetA+(k*strideA1), A, strideA2, offsetA+(row*strideA1) ); // eslint-disable-line max-len\n\t\t\t}\n\t\t\tip += strideIPIV;\n\t\t}\n\t\treturn A;\n\t}\n\t// If the order is column-major, we need to use loop tiling to ensure efficient cache access when accessing matrix elements...\n\tn32 = floor( N/BLOCK_SIZE ) * BLOCK_SIZE;\n\tif ( n32 !== 0 ) {\n\t\tfor ( j = 0; j < n32; j += BLOCK_SIZE ) {\n\t\t\tip = offsetIPIV;\n\t\t\tfor ( i = 0, k = k1; i < nrows; i++, k += inck ) {\n\t\t\t\trow = IPIV[ ip ];\n\t\t\t\tif ( row !== k ) {\n\t\t\t\t\tia1 = offsetA + ( k*strideA1 );\n\t\t\t\t\tia2 = offsetA + ( row*strideA1 );\n\t\t\t\t\tfor ( n = j; n < j+BLOCK_SIZE; n++ ) {\n\t\t\t\t\t\to = n * strideA2;\n\t\t\t\t\t\ttmp = A[ ia1+o ];\n\t\t\t\t\t\tA[ ia1+o ] = A[ ia2+o ];\n\t\t\t\t\t\tA[ ia2+o ] = tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tip += strideIPIV;\n\t\t\t}\n\t\t}\n\t}\n\tif ( n32 !== N ) {\n\t\tip = offsetIPIV;\n\t\tfor ( i = 0, k = k1; i < nrows; i++, k += inck ) {\n\t\t\trow = IPIV[ ip ];\n\t\t\tif ( row !== k ) {\n\t\t\t\tia1 = offsetA + ( k*strideA1 );\n\t\t\t\tia2 = offsetA + ( row*strideA1 );\n\t\t\t\tfor ( n = n32; n < N; n++ ) {\n\t\t\t\t\to = n * strideA2;\n\t\t\t\t\ttmp = A[ ia1+o ];\n\t\t\t\t\tA[ ia1+o ] = A[ ia2+o ];\n\t\t\t\t\tA[ ia2+o ] = tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t\tip += strideIPIV;\n\t\t}\n\t}\n\treturn A;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isLayout = require( '@stdlib/blas-base-assert-is-layout' );\nvar isRowMajor = require( '@stdlib/ndarray-base-assert-is-row-major-string' );\nvar isColumnMajor = require( '@stdlib/ndarray-base-assert-is-column-major-string' );\nvar max = require( '@stdlib/math-base-special-max' );\nvar format = require( '@stdlib/string-format' );\nvar base = require( './base.js' );\n\n\n// MAIN //\n\n/**\n* Performs a series of row interchanges on a matrix `A` using pivot indices stored in `IPIV`.\n*\n* @param {string} order - storage layout\n* @param {PositiveInteger} N - number of columns in `A`\n* @param {Float64Array} A - input matrix\n* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)\n* @param {NonNegativeInteger} k1 - index of first row to interchange\n* @param {NonNegativeInteger} k2 - index of last row to interchange\n* @param {Int32Array} IPIV - vector of pivot indices\n* @param {integer} incx - increment between successive values of `IPIV`\n* @throws {TypeError} first argument must be a valid order\n* @throws {RangeError} fourth argument must be greater than or equal to max(1,N)\n* @returns {Float64Array} permuted matrix `A`\n*\n* @example\n* var Int32Array = require( '@stdlib/array-int32' );\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var IPIV = new Int32Array( [ 2, 0, 1 ] );\n* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // => [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]\n*\n* dlaswp( 'row-major', 2, A, 2, 0, 2, IPIV, 1 );\n* // A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]\n*/\nfunction dlaswp( order, N, A, LDA, k1, k2, IPIV, incx ) {\n\tvar tmp;\n\tvar inc;\n\tvar sa1;\n\tvar sa2;\n\tvar io;\n\tif ( !isLayout( order ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );\n\t}\n\tif ( isRowMajor( order ) && LDA < max( 1, N ) ) {\n\t\tthrow new RangeError( format( 'invalid argument. Fourth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) );\n\t}\n\tif ( incx > 0 ) {\n\t\tinc = 1;\n\t\tio = k1;\n\t} else if ( incx < 0 ) {\n\t\tinc = -1;\n\t\tio = k1 + ( (k1-k2) * incx );\n\t\ttmp = k1;\n\t\tk1 = k2;\n\t\tk2 = tmp;\n\t} else {\n\t\treturn A;\n\t}\n\tif ( isColumnMajor( order ) ) {\n\t\tsa1 = 1;\n\t\tsa2 = LDA;\n\t} else { // order === 'row-major'\n\t\tsa1 = LDA;\n\t\tsa2 = 1;\n\t}\n\treturn base( N, A, sa1, sa2, 0, k1, k2, inc, IPIV, incx, io );\n}\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar base = require( './base.js' );\n\n\n// MAIN //\n\n/**\n* Performs a series of row interchanges on a matrix `A` using pivot indices stored in `IPIV`.\n*\n* @param {PositiveInteger} N - number of columns in `A`\n* @param {Float64Array} A - input matrix\n* @param {integer} strideA1 - stride of the first dimension of `A`\n* @param {integer} strideA2 - stride of the second dimension of `A`\n* @param {NonNegativeInteger} offsetA - index offset for `A`\n* @param {NonNegativeInteger} k1 - index of first row to interchange\n* @param {NonNegativeInteger} k2 - index of last row to interchange\n* @param {integer} inck - direction in which to apply pivots (-1 to apply pivots in reverse order; otherwise, apply in provided order)\n* @param {Int32Array} IPIV - vector of pivot indices\n* @param {integer} strideIPIV - `IPIV` stride length\n* @param {NonNegativeInteger} offsetIPIV - index offset for `IPIV`\n* @returns {Float64Array} permuted matrix `A`\n*\n* @example\n* var Int32Array = require( '@stdlib/array-int32' );\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var IPIV = new Int32Array( [ 2, 0, 1 ] );\n* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // => [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]\n*\n* dlaswp( 2, A, 2, 1, 0, 0, 2, 1, IPIV, 1, 0 );\n* // A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]\n*/\nfunction dlaswp( N, A, strideA1, strideA2, offsetA, k1, k2, inck, IPIV, strideIPIV, offsetIPIV ) { // eslint-disable-line max-len, max-params\n\tvar tmp;\n\tif ( inck < 0 ) {\n\t\toffsetIPIV += k2 * strideIPIV;\n\t\tstrideIPIV *= -1;\n\t\ttmp = k1;\n\t\tk1 = k2;\n\t\tk2 = tmp;\n\t\tinck = -1;\n\t} else {\n\t\toffsetIPIV += k1 * strideIPIV;\n\t\tinck = 1;\n\t}\n\treturn base( N, A, strideA1, strideA2, offsetA, k1, k2, inck, IPIV, strideIPIV, offsetIPIV ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar dlaswp = require( './dlaswp.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( dlaswp, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = dlaswp;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* LAPACK routine to perform a series of row interchanges on an input matrix.\n*\n* @module @stdlib/lapack-base-dlaswp\n*\n* @example\n* var Int32Array = require( '@stdlib/array-int32' );\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dlaswp = require( '@stdlib/lapack-base-dlaswp' );\n*\n* var IPIV = new Int32Array( [ 2, 0, 1 ] );\n* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); // => [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]\n*\n* dlaswp( 'row-major', 2, A, 2, 0, 2, IPIV, 1 );\n* // A => <Float64Array>[ 3.0, 4.0, 1.0, 2.0, 5.0, 6.0 ]\n*/\n\n// MODULES //\n\nvar join = require( 'path' ).join;\nvar tryRequire = require( '@stdlib/utils-try-require' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar main = require( './main.js' );\n\n\n// MAIN //\n\nvar dlaswp;\nvar tmp = tryRequire( join( __dirname, './native.js' ) );\nif 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ideA2", "offsetA", "k1", "k2", "inck", "IPIV", "strideIPIV", "offsetIPIV", "nrows", "n32", "tmp", "row", "ia1", "ia2", "ip", "i", "j", "k", "n", "o", "require_dlaswp", "__commonJSMin", "exports", "module", "isLayout", "isRowMajor", "isColumnMajor", "max", "format", "base", "dlaswp", "order", "N", "A", "LDA", "k1", "k2", "IPIV", "incx", "tmp", "inc", "sa1", "sa2", "io", "require_ndarray", "__commonJSMin", "exports", "module", "base", "dlaswp", "N", "A", "strideA1", "strideA2", "offsetA", "k1", "k2", "inck", "IPIV", "strideIPIV", "offsetIPIV", "tmp", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "dlaswp", "ndarray", "join", "tryRequire", "isError", "main", "dlaswp", "tmp"]
7
7
  }
package/lib/dlaswp.js CHANGED
@@ -21,6 +21,8 @@
21
21
  // MODULES //
22
22
 
23
23
  var isLayout = require( '@stdlib/blas-base-assert-is-layout' );
24
+ var isRowMajor = require( '@stdlib/ndarray-base-assert-is-row-major-string' );
25
+ var isColumnMajor = require( '@stdlib/ndarray-base-assert-is-column-major-string' );
24
26
  var max = require( '@stdlib/math-base-special-max' );
25
27
  var format = require( '@stdlib/string-format' );
26
28
  var base = require( './base.js' );
@@ -62,7 +64,7 @@ function dlaswp( order, N, A, LDA, k1, k2, IPIV, incx ) {
62
64
  if ( !isLayout( order ) ) {
63
65
  throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
64
66
  }
65
- if ( order === 'row-major' && LDA < max( 1, N ) ) {
67
+ if ( isRowMajor( order ) && LDA < max( 1, N ) ) {
66
68
  throw new RangeError( format( 'invalid argument. Fourth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) );
67
69
  }
68
70
  if ( incx > 0 ) {
@@ -77,7 +79,7 @@ function dlaswp( order, N, A, LDA, k1, k2, IPIV, incx ) {
77
79
  } else {
78
80
  return A;
79
81
  }
80
- if ( order === 'column-major' ) {
82
+ if ( isColumnMajor( order ) ) {
81
83
  sa1 = 1;
82
84
  sa2 = LDA;
83
85
  } else { // order === 'row-major'
package/lib/index.js CHANGED
@@ -57,3 +57,5 @@ if ( isError( tmp ) ) {
57
57
  // EXPORTS //
58
58
 
59
59
  module.exports = dlaswp;
60
+
61
+ // exports: { "ndarray": "dlaswp.ndarray" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/lapack-base-dlaswp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Perform a series of row interchanges on an input matrix.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -32,10 +32,12 @@
32
32
  "dependencies": {
33
33
  "@stdlib/assert-is-error": "^0.2.2",
34
34
  "@stdlib/blas-base-assert-is-layout": "^0.0.2",
35
- "@stdlib/blas-base-dswap": "^0.3.0",
35
+ "@stdlib/blas-base-dswap": "^0.4.0",
36
36
  "@stdlib/math-base-special-floor": "^0.2.3",
37
37
  "@stdlib/math-base-special-max": "^0.3.0",
38
+ "@stdlib/ndarray-base-assert-is-column-major-string": "^0.1.0",
38
39
  "@stdlib/ndarray-base-assert-is-row-major": "^0.2.2",
40
+ "@stdlib/ndarray-base-assert-is-row-major-string": "^0.1.0",
39
41
  "@stdlib/string-format": "^0.2.2",
40
42
  "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",
41
43
  "@stdlib/utils-try-require": "^0.2.2",