From 4f50184627f77516bd1c0ff77ae2d27cbc95f3ec Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Apr 2022 07:26:58 +0000 Subject: [PATCH 001/131] Auto-generated commit ef2af423fa53afef98acadb2e6d3a5d268bdf940 --- CONTRIBUTORS | 28 +++ LICENSE | 481 +++++++++++++++++++++++++++++++++++++++++++++++++++ NOTICE | 1 + README.md | 239 +++++++++++++++++++++++++ mod.d.ts | 394 +++++++++++++++++++++++++++++++++++++++++ mod.js | 4 + mod.js.map | 1 + package.json | 35 ++++ 8 files changed, 1183 insertions(+) create mode 100644 CONTRIBUTORS create mode 100644 LICENSE create mode 100644 NOTICE create mode 100644 README.md create mode 100644 mod.d.ts create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 package.json diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 0000000..e5c896d --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,28 @@ +# This file is generated by tools/scripts/update_contributors. +# +# Contributors listed in alphabetical order. + +Ali Salesi +Athan Reines +Brendan Graetz +Bruno Fenzl +Christopher Dambamuromo +Dominik Moritz +Frank Kovacs +James +Jithin KS +Joey Reed +Joris Labie +Justin Dennison +Marcus +Matt Cochrane +Milan Raj +Momtchil Momtchev +Ognjen Jevremović +Philipp Burckhardt +Ricky Reusser +Ryan Seal +Seyyed Parsa Neshaei +Shraddheya Shendre +dorrin-sot <59933477+dorrin-sot@users.noreply.github.com> +rei2hu diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fcc9934 --- /dev/null +++ b/LICENSE @@ -0,0 +1,481 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + + +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by this +license (the "Software") to use, reproduce, display, distribute, execute, and +transmit the Software, and to prepare derivative works of the Software, and to +permit third-parties to whom the Software is furnished to do so, all subject to +the following: + +The copyright notices in the Software and this entire statement, including the +above license grant, this restriction and the following disclaimer, must be +included in all copies of the Software, in whole or in part, and all derivative +works of the Software, unless such copies or derivative works are solely in the +form of machine-executable object code generated by a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES +OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + +DEPENDENCIES + +The library links against the following external libraries, which have their own +licenses: + +* OpenBLAS + +Copyright (c) 2011-2014, The OpenBLAS Project +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. Neither the name of the OpenBLAS project nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +* Electron + +Copyright (c) 2013-2017 GitHub Inc. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +* Boost + +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + + +* Cephes + +Copyright (c) 1984-2000 Stephen L. Moshier + +Some software in this archive may be from the book _Methods and Programs for +Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) +or from the Cephes Mathematical Library, a commercial product. In either event, +it is copyrighted by the author. What you see here may be used freely but it +comes with no support or guarantee. + +Stephen L. Moshier +moshier@na-net.ornl.gov + + + +ATTRIBUTION + +The library contains implementations from the following external libraries, +which have their own licenses: + +* FreeBSD + +Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. + + +* FDLIBM + +Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. + + +* Go + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +* SLATEC Common Mathematical Library + +Public domain. + + +* ESLint + +Copyright JS Foundation and other contributors, https://js.foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +* StatsFuns.jl + +Copyright (c) 2015: Dahua Lin. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +* SpecialFunctions.jl + +The MIT License (MIT) + +Copyright (c) 2017 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and others: + +https://github.com/JuliaMath/SpecialFunctions.jl/graphs/contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +* MT19937 + +Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..10e6ba1 --- /dev/null +++ b/NOTICE @@ -0,0 +1 @@ +Copyright (c) 2016-2022 The Stdlib Authors. diff --git a/README.md b/README.md new file mode 100644 index 0000000..58a2cd4 --- /dev/null +++ b/README.md @@ -0,0 +1,239 @@ + + +# transpose + +[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] + +> Transpose a matrix (or a stack of matrices). + + + +
+ +
+ + + + + + + +
+ +## Usage + +```javascript +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +``` + +#### transpose( x ) + +Transposes a matrix (or a stack of matrices) `x`. + +```javascript +import array from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-array@deno/mod.js'; + +var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] ); +// returns + +var sh = x.shape; +// returns [ 2, 3 ] + +var y = transpose( x ); +// returns + +sh = y.shape; +// returns [ 3, 2 ] + +var bool = ( x.data === y.data ); +// returns true + +bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +// returns true +``` + +
+ + + + + +
+ +## Notes + +- The returned ndarray is a **view** of the input ndarray. Accordingly, writing to the original ndarray will **mutate** the returned ndarray and vice versa. While powerful, this can lead to subtle bugs. In general, one should handle the returned ndarray as **read-only**. +- If provided an ndarray with fewer than two dimensions, the function raises an exception. + +
+ + + + + +
+ +## Examples + + + + + +```javascript +import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; +import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; +import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; + +function print( arr, name ) { + var str; + var sh; + var p; + var i; + var j; + var k; + + sh = arr.shape; + for ( i = 0; i < sh[0]; i++ ) { + str = name+'['+i+',:,:] = [ '; + p = str.length + 1; + for ( j = 0; j < sh[1]; j++ ) { + if ( j > 0 ) { + str += rpad( '\n', p, ' ' ); + } + for ( k = 0; k < sh[2]; k++ ) { + str += arr.get( i, j, k ); + if ( k < sh[2]-1 ) { + str += ', '; + } + } + } + console.log( str + ' ]\n' ); + } +} + +// Create a data buffer: +var buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +// Create a stack of matrices: +var x = new ndarray( 'float64', buf, [ 2, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); + +// Transpose the stack of matrices: +var y = transpose( x ); + +// Print the stacks: +console.log( '' ); +print( x, 'X' ); +console.log( '' ); +print( y, 'Y' ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + +
+ +* * * + +## Notice + +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. + +For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. + +#### Community + +[![Chat][chat-image]][chat-url] + +--- + +## License + +See [LICENSE][stdlib-license]. + + +## Copyright + +Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. + +
+ + + + + + + + diff --git a/mod.d.ts b/mod.d.ts new file mode 100644 index 0000000..8ba190a --- /dev/null +++ b/mod.d.ts @@ -0,0 +1,394 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2022 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. +*/ + +// TypeScript Version: 2.0 + +/// + +import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'float64' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: float64ndarray ): float64ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'float32' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: float32ndarray ): float32ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var Complex128Array = require( `@stdlib/array/complex128` ); +* var ndarray = require( `@stdlib/ndarray/ctor` ); +* +* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); +* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: complex128ndarray ): complex128ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var Complex64Array = require( `@stdlib/array/complex64` ); +* var ndarray = require( `@stdlib/ndarray/ctor` ); +* +* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); +* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: complex64ndarray ): complex64ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'int32' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: int32ndarray ): int32ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'int16' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: int16ndarray ): int16ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'int8' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: int8ndarray ): int8ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'uint32' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: uint32ndarray ): uint32ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'uint16' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: uint16ndarray ): uint16ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'uint8' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: uint8ndarray ): uint8ndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'uint8c' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: uint8cndarray ): uint8cndarray; + +/** +* Transposes a matrix (or a stack of matrices). +* +* @param x - input array +* @returns ndarray view +* +* @example +* var array = require( `@stdlib/ndarray/array` ); +* +* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { +* 'dtype': 'generic' +* }); +* // returns +* +* var sh = x.shape; +* // returns [ 2, 3 ] +* +* var y = transpose( x ); +* // returns +* +* sh = y.shape; +* // returns [ 3, 2 ] +* +* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); +* // returns true +* +* bool = ( x.data === y.data ); +* // returns true +*/ +declare function transpose( x: ndarray ): ndarray; + + +// EXPORTS // + +export = transpose; diff --git a/mod.js b/mod.js new file mode 100644 index 0000000..afd308b --- /dev/null +++ b/mod.js @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +var r=function(r,n){var t,e,a;for(e=r.length,t=0,a=0;a\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Transpose a matrix (or a stack of matrices).\n*\n* @module @stdlib/ndarray-base-transpose\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var transpose = require( '@stdlib/ndarray-base-transpose' );\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],"names":["strides2offset","shape","strides","offset","ndims","i","length","lib","x","tmp","sh","st","N","Error","constructor","dtype","data","order"],"mappings":";;AAuDA,ICjCIA,EDcJ,SAAyBC,EAAOC,GAC/B,IAAIC,EACAC,EACAC,EAIJ,IAFAD,EAAQH,EAAMK,OACdH,EAAS,EACHE,EAAI,EAAGA,EAAID,EAAOC,IAClBH,EAASG,GAAM,IAEnBF,GAAUD,EAASG,IAAQJ,EAAOI,GAAI,IAGxC,OAAOF,GCiCR,IC3BAI,EDAA,SAAoBC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEP,OACAK,QACE,EACR,MAAM,IAAIO,MAAO,4EAYlB,OAVAF,EAAKH,EAAEN,QAEPO,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEM,YAAaN,EAAEO,MAAOP,EAAEQ,KAAMN,EAAIC,EAAIX,EAAgBU,EAAIC,GAAMH,EAAES"} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..da60d61 --- /dev/null +++ b/package.json @@ -0,0 +1,35 @@ +{ + "name": "@stdlib/ndarray-base-transpose", + "version": "0.0.0", + "description": "Transpose a matrix (or a stack of matrices).", + "license": "Apache-2.0", + "type": "module", + "main": "./mod.js", + "homepage": "https://stdlib.io", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/ndarray-base-transpose.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "keywords": [ + "stdlib", + "stdtypes", + "types", + "base", + "data", + "structure", + "ndarray", + "matrix", + "transpose", + "stack", + "permute", + "swap", + "swapaxes" + ], + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/athan" + } +} From 60e89e042f9aa498615aabd29cebec5fe1b0016c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 30 Jun 2022 23:48:08 +0000 Subject: [PATCH 002/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 330ad01..05f4ab1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 2a1672c8ce79020005265b9dcf3f92f5ae146bda Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 11:21:17 +0000 Subject: [PATCH 003/131] Remove files --- mod.d.ts | 394 ----------------------------------------------------- mod.js | 4 - mod.js.map | 1 - 3 files changed, 399 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index afd308b..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -var r=function(r,n){var t,e,a;for(e=r.length,t=0,a=0;a\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Transpose a matrix (or a stack of matrices).\n*\n* @module @stdlib/ndarray-base-transpose\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var transpose = require( '@stdlib/ndarray-base-transpose' );\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],"names":["strides2offset","shape","strides","offset","ndims","i","length","lib","x","tmp","sh","st","N","Error","constructor","dtype","data","order"],"mappings":";;AAuDA,ICjCIA,EDcJ,SAAyBC,EAAOC,GAC/B,IAAIC,EACAC,EACAC,EAIJ,IAFAD,EAAQH,EAAMK,OACdH,EAAS,EACHE,EAAI,EAAGA,EAAID,EAAOC,IAClBH,EAASG,GAAM,IAEnBF,GAAUD,EAASG,IAAQJ,EAAOI,GAAI,IAGxC,OAAOF,GCiCR,IC3BAI,EDAA,SAAoBC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEP,OACAK,QACE,EACR,MAAM,IAAIO,MAAO,4EAYlB,OAVAF,EAAKH,EAAEN,QAEPO,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEM,YAAaN,EAAEO,MAAOP,EAAEQ,KAAMN,EAAIC,EAAIX,EAAgBU,EAAIC,GAAMH,EAAES"} \ No newline at end of file From 9c9360aa8a609d9b1aeb4fc0db63856a4ee024d6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 11:22:36 +0000 Subject: [PATCH 004/131] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 33 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 681 ------ .github/workflows/publish.yml | 157 -- .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 30 +- benchmark/benchmark.js | 294 --- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 905 ------- 49 files changed, 2705 insertions(+), 5647 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 143e4c9..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-06-30T21:26:43.564Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 128c22e..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,681 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the repository: - push: - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf - - git add -A - git commit -m "Remove files" - - git merge -s recursive -X theirs origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch or create new branch tag: - - name: 'Push changes to `deno` branch or create new branch tag' - run: | - SLUG=${{ github.repository }} - VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p') - if [ -z "$VERSION" ]; then - echo "Workflow job was not triggered by a new tag...." - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - else - echo "Workflow job was triggered by a new tag: $VERSION" - echo "Creating new bundle branch tag of the form $VERSION-deno" - git tag -a $VERSION-deno -m "$VERSION-deno" - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno - fi - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf - - git add -A - git commit -m "Remove files" - - git merge -s recursive -X theirs origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From c91a6d1f94822459e466331858990c2dcfd07cd7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 17:21:52 +0000 Subject: [PATCH 005/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 330ad01..05f4ab1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From b13bdc2f9ef7f0a0b2f4f2b7804862cf377ba84f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 02:02:20 +0000 Subject: [PATCH 006/131] Remove files --- mod.d.ts | 394 -------- mod.js | 4 - mod.js.map | 1 - stats.html | 2689 ---------------------------------------------------- 4 files changed, 3088 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 78692ff..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function t(t){var r=t.default;if("function"==typeof r){var n=function(){return r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var e=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,e.get?e:{enumerable:!0,get:function(){return t[r]}})})),n}var r="function"==typeof Object.defineProperty?Object.defineProperty:null;var n=function(){try{return r({},"x",{}),!0}catch(t){return!1}},e=Object.defineProperty,o=Object.prototype,i=o.toString,u=o.__defineGetter__,a=o.__defineSetter__,f=o.__lookupGetter__,c=o.__lookupSetter__;var s=function(t,r,n){var e,s,l,h;if("object"!=typeof t||null===t||"[object Array]"===i.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof n||null===n||"[object Array]"===i.call(n))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+n+"`.");if((s="value"in n)&&(f.call(t,r)||c.call(t,r)?(e=t.__proto__,t.__proto__=o,delete t[r],t[r]=n.value,t.__proto__=e):t[r]=n.value),l="get"in n,h="set"in n,s&&(l||h))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return l&&u&&u.call(t,r,n.get),h&&a&&a.call(t,r,n.set),t},l=e,h=s,p=n()?l:h,y=p;var v=function(t,r,n){y(t,r,{configurable:!1,enumerable:!1,writable:!1,value:n})},g=v;var w=function(t){return"string"==typeof t};var d=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();var b=function(){return d&&"symbol"==typeof Symbol.toStringTag},m=Object.prototype.toString,A=m;var E=function(t){return A.call(t)},_=Object.prototype.hasOwnProperty;var O=function(t,r){return null!=t&&_.call(t,r)},P="function"==typeof Symbol?Symbol.toStringTag:"",j=O,R=P,T=m;var U=E,I=function(t){var r,n,e;if(null==t)return T.call(t);n=t[R],r=j(t,R);try{t[R]=void 0}catch(r){return T.call(t)}return e=T.call(t),r?t[R]=n:delete t[R],e},S=b()?I:U,B=String.prototype.valueOf;var Y=S,x=function(t){try{return B.call(t),!0}catch(t){return!1}},C=b();var M=function(t){return"object"==typeof t&&(t instanceof String||(C?x(t):"[object String]"===Y(t)))},L=w,F=M;var D=g,N=function(t){return L(t)||F(t)},k=M;D(N,"isPrimitive",w),D(N,"isObject",k);var V=N,z=V.isPrimitive,G=/[-\/\\^$*+?.()|[\]{}]/g;var X=function(t){var r,n;if(!z(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");if("/"===t[0])for(n=t.length-1;n>=0&&"/"!==t[n];n--);return void 0===n||n<=0?t.replace(G,"\\$&"):(r=(r=t.substring(1,n)).replace(G,"\\$&"),t=t[0]+r+t.substring(n))},$=/./;var H=function(t){return"boolean"==typeof t},W=Boolean.prototype.toString;var q=S,J=function(t){try{return W.call(t),!0}catch(t){return!1}},Z=b();var K=function(t){return"object"==typeof t&&(t instanceof Boolean||(Z?J(t):"[object Boolean]"===q(t)))},Q=H,tt=K;var rt=g,nt=function(t){return Q(t)||tt(t)},et=K;rt(nt,"isPrimitive",H),rt(nt,"isObject",et);var ot=nt;var it=function(){return new Function("return this;")()},ut="object"==typeof self?self:null,at="object"==typeof window?window:null,ft="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},ct="object"==typeof ft?ft:null;module.exports=ct;var st=ot.isPrimitive,lt=it,ht=ut,pt=at,yt=t(Object.freeze({__proto__:null}));var vt=function(t){if(arguments.length){if(!st(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return lt()}if(ht)return ht;if(pt)return pt;if(yt)return yt;throw new Error("unexpected error. Unable to resolve global object.")},gt=vt(),wt=gt.document&>.document.childNodes,dt=Int8Array,bt=$,mt=wt,At=dt;var Et=function(){return"function"==typeof bt||"object"==typeof At||"function"==typeof mt};var _t=function(){return/^\s*function\s*([^(]*)/i},Ot=_t;g(Ot,"REGEXP",_t());var Pt=Ot,jt=S;var Rt=Array.isArray?Array.isArray:function(t){return"[object Array]"===jt(t)},Tt=Rt;var Ut=function(t){return null!==t&&"object"==typeof t};g(Ut,"isObjectLikeArray",function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(r){var n,e;if(!Tt(r))return!1;if(0===(n=r.length))return!1;for(e=0;edr&&br(t)},Ar=hr.isPrimitive,Er=mr;var _r=function(t){return Ar(t)&&Er(t)},Or=hr.isObject,Pr=mr;var jr=function(t){return Or(t)&&Pr(t.valueOf())},Rr=_r,Tr=jr;var Ur=g,Ir=function(t){return Rr(t)||Tr(t)},Sr=jr;Ur(Ir,"isPrimitive",_r),Ur(Ir,"isObject",Sr);var Br=Ir,Yr=Br.isPrimitive;var xr=function(t){return Yr(t)&&t>=0},Cr=Br.isObject;var Mr=function(t){return Cr(t)&&t.valueOf()>=0},Lr=xr,Fr=Mr;var Dr=g,Nr=function(t){return Lr(t)||Fr(t)},kr=Mr;Dr(Nr,"isPrimitive",xr),Dr(Nr,"isObject",kr);var Vr=Nr,zr=Object.getPrototypeOf;var Gr=function(t){return t.__proto__},Xr=S,$r=Gr;var Hr=function(t){var r=$r(t);return r||null===r?r:"[object Function]"===Xr(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null},Wr=zr,qr=Hr,Jr=zt(Object.getPrototypeOf)?Wr:qr;var Zr=function(t){return null==t?null:(t=Object(t),Jr(t))},Kr=Zr,Qr=S;var tn=function(t){if("object"!=typeof t||null===t)return!1;if(t instanceof Error)return!0;for(;t;){if("[object Error]"===Qr(t))return!0;t=Kr(t)}return!1};var rn=function(){return/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/},nn=rn;g(nn,"REGEXP",rn());var en=V.isPrimitive,on=nn;var un=function(t){if(!en(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");return(t=on().exec(t))?new RegExp(t[1],t[2]):null};var an=function(t){return t!=t},fn=hr.isPrimitive,cn=an;var sn=function(t){return fn(t)&&cn(t)},ln=hr.isObject,hn=an;var pn=function(t){return ln(t)&&hn(t.valueOf())},yn=sn,vn=pn;var gn=g,wn=function(t){return yn(t)||vn(t)},dn=pn;gn(wn,"isPrimitive",sn),gn(wn,"isObject",dn);var bn=wn,mn=gr;var An=bn,En=function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&mn(t.length)&&t.length>=0&&t.length<=9007199254740991},_n=V.isPrimitive,On=Br.isPrimitive;var Pn=function(t,r,n){var e,o;if(!En(t)&&!_n(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(e=t.length))return-1;if(3===arguments.length){if(!On(n))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+n+"`.");if(n>=0){if(n>=e)return-1;o=n}else(o=e+n)<0&&(o=0)}else o=0;if(An(r)){for(;o=0&&r=0&&t.length<=4294967295&&zn(t,"callee")&&!Gn(t,"callee")},Wn=Hn,qn=jn,Jn=Array.prototype.slice;var Zn=function(t){return Wn(t)?qn(Jn.call(t)):qn(t)};var Kn=Vn((function(){}),"prototype"),Qn=!Vn({toString:null},"toString");var te,re=function(t){return t.constructor&&t.constructor.prototype===t},ne="undefined"==typeof window?void 0:window,ee=O,oe=Pn,ie=kt,ue=re,ae=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],fe=ne;te=function(){var t;if("undefined"===ie(fe))return!1;for(t in fe)try{-1===oe(ae,t)&&ee(fe,t)&&null!==fe[t]&&"object"===ie(fe[t])&&ue(fe[t])}catch(t){return!0}return!1}();var ce="undefined"!=typeof window,se=te,le=re,he=ce;var pe=It,ye=O,ve=Hn,ge=Kn,we=Qn,de=function(t){if(!1===he&&!se)return le(t);try{return le(t)}catch(t){return!1}},be=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var me=jn,Ae=Zn,Ee=function(t){var r,n,e,o,i,u,a;if(o=[],ve(t)){for(a=0;a0&&!ye(t,"0"))for(a=0;a>18&63]+Be[o>>12&63]+Be[o>>6&63]+Be[63&o]);return i.join("")}function Fe(t){var r;Ce||Me();for(var n=t.length,e=n%3,o="",i=[],u=16383,a=0,f=n-e;af?f:a+u));return 1===e?(r=t[n-1],o+=Be[r>>2],o+=Be[r<<4&63],o+="=="):2===e&&(r=(t[n-2]<<8)+t[n-1],o+=Be[r>>10],o+=Be[r>>4&63],o+=Be[r<<2&63],o+="="),i.push(o),i.join("")}function De(t,r,n,e,o){var i,u,a=8*o-e-1,f=(1<>1,s=-7,l=n?o-1:0,h=n?-1:1,p=t[r+l];for(l+=h,i=p&(1<<-s)-1,p>>=-s,s+=a;s>0;i=256*i+t[r+l],l+=h,s-=8);for(u=i&(1<<-s)-1,i>>=-s,s+=e;s>0;u=256*u+t[r+l],l+=h,s-=8);if(0===i)i=1-c;else{if(i===f)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,e),i-=c}return(p?-1:1)*u*Math.pow(2,i-e)}function Ne(t,r,n,e,o,i){var u,a,f,c=8*i-o-1,s=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=e?0:i-1,y=e?1:-1,v=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-u))<1&&(u--,f*=2),(r+=u+l>=1?h/f:h*Math.pow(2,1-l))*f>=2&&(u++,f/=2),u+l>=s?(a=0,u=s):u+l>=1?(a=(r*f-1)*Math.pow(2,o),u+=l):(a=r*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[n+p]=255&a,p+=y,a/=256,o-=8);for(u=u<0;t[n+p]=255&u,p+=y,u/=256,c-=8);t[n+p-y]|=128*v}var ke={}.toString,Ve=Array.isArray||function(t){return"[object Array]"==ke.call(t)};$e.TYPED_ARRAY_SUPPORT=void 0===ft.TYPED_ARRAY_SUPPORT||ft.TYPED_ARRAY_SUPPORT;var ze=Ge();function Ge(){return $e.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Xe(t,r){if(Ge()=Ge())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ge().toString(16)+" bytes");return 0|t}function Ke(t){return!(null==t||!t._isBuffer)}function Qe(t,r){if(Ke(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return jo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Ro(t).length;default:if(e)return jo(t).length;r=(""+r).toLowerCase(),e=!0}}function to(t,r,n){var e=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return yo(this,r,n);case"utf8":case"utf-8":return lo(this,r,n);case"ascii":return ho(this,r,n);case"latin1":case"binary":return po(this,r,n);case"base64":return so(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vo(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),e=!0}}function ro(t,r,n){var e=t[r];t[r]=t[n],t[n]=e}function no(t,r,n,e,o){if(0===t.length)return-1;if("string"==typeof n?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=$e.from(r,e)),Ke(r))return 0===r.length?-1:eo(t,r,n,e,o);if("number"==typeof r)return r&=255,$e.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):eo(t,[r],n,e,o);throw new TypeError("val must be string, number or Buffer")}function eo(t,r,n,e,o){var i,u=1,a=t.length,f=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(t.length<2||r.length<2)return-1;u=2,a/=2,f/=2,n/=2}function c(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var s=-1;for(i=n;ia&&(n=a-f),i=n;i>=0;i--){for(var l=!0,h=0;ho&&(e=o):e=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");e>i/2&&(e=i/2);for(var u=0;u>8,o=n%256,i.push(o),i.push(e);return i}(r,t.length-n),t,n,e)}function so(t,r,n){return 0===r&&n===t.length?Fe(t):Fe(t.slice(r,n))}function lo(t,r,n){n=Math.min(t.length,n);for(var e=[],o=r;o239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(s=c);break;case 2:128==(192&(i=t[o+1]))&&(f=(31&c)<<6|63&i)>127&&(s=f);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(f=(15&c)<<12|(63&i)<<6|63&u)>2047&&(f<55296||f>57343)&&(s=f);break;case 4:i=t[o+1],u=t[o+2],a=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&(f=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&a)>65535&&f<1114112&&(s=f)}null===s?(s=65533,l=1):s>65535&&(s-=65536,e.push(s>>>10&1023|55296),s=56320|1023&s),e.push(s),o+=l}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var n="",e=0;for(;e0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},$e.prototype.compare=function(t,r,n,e,o){if(!Ke(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===e&&(e=0),void 0===o&&(o=this.length),r<0||n>t.length||e<0||o>this.length)throw new RangeError("out of range index");if(e>=o&&r>=n)return 0;if(e>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(e>>>=0),u=(n>>>=0)-(r>>>=0),a=Math.min(i,u),f=this.slice(e,o),c=t.slice(r,n),s=0;so)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var i=!1;;)switch(e){case"hex":return oo(this,t,r,n);case"utf8":case"utf-8":return io(this,t,r,n);case"ascii":return uo(this,t,r,n);case"latin1":case"binary":return ao(this,t,r,n);case"base64":return fo(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return co(this,t,r,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),i=!0}},$e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ho(t,r,n){var e="";n=Math.min(t.length,n);for(var o=r;oe)&&(n=e);for(var o="",i=r;in)throw new RangeError("Trying to access beyond buffer length")}function wo(t,r,n,e,o,i){if(!Ke(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function bo(t,r,n,e){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-n,2);o>>8*(e?o:1-o)}function mo(t,r,n,e){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-n,4);o>>8*(e?o:3-o)&255}function Ao(t,r,n,e,o,i){if(n+e>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Eo(t,r,n,e,o){return o||Ao(t,0,n,4),Ne(t,r,n,e,23,4),n+4}function _o(t,r,n,e,o){return o||Ao(t,0,n,8),Ne(t,r,n,e,52,8),n+8}$e.prototype.slice=function(t,r){var n,e=this.length;if((t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r0&&(o*=256);)e+=this[t+--r]*o;return e},$e.prototype.readUInt8=function(t,r){return r||go(t,1,this.length),this[t]},$e.prototype.readUInt16LE=function(t,r){return r||go(t,2,this.length),this[t]|this[t+1]<<8},$e.prototype.readUInt16BE=function(t,r){return r||go(t,2,this.length),this[t]<<8|this[t+1]},$e.prototype.readUInt32LE=function(t,r){return r||go(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},$e.prototype.readUInt32BE=function(t,r){return r||go(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},$e.prototype.readIntLE=function(t,r,n){t|=0,r|=0,n||go(t,r,this.length);for(var e=this[t],o=1,i=0;++i=(o*=128)&&(e-=Math.pow(2,8*r)),e},$e.prototype.readIntBE=function(t,r,n){t|=0,r|=0,n||go(t,r,this.length);for(var e=r,o=1,i=this[t+--e];e>0&&(o*=256);)i+=this[t+--e]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},$e.prototype.readInt8=function(t,r){return r||go(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},$e.prototype.readInt16LE=function(t,r){r||go(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},$e.prototype.readInt16BE=function(t,r){r||go(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},$e.prototype.readInt32LE=function(t,r){return r||go(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},$e.prototype.readInt32BE=function(t,r){return r||go(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},$e.prototype.readFloatLE=function(t,r){return r||go(t,4,this.length),De(this,t,!0,23,4)},$e.prototype.readFloatBE=function(t,r){return r||go(t,4,this.length),De(this,t,!1,23,4)},$e.prototype.readDoubleLE=function(t,r){return r||go(t,8,this.length),De(this,t,!0,52,8)},$e.prototype.readDoubleBE=function(t,r){return r||go(t,8,this.length),De(this,t,!1,52,8)},$e.prototype.writeUIntLE=function(t,r,n,e){(t=+t,r|=0,n|=0,e)||wo(this,t,r,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+n},$e.prototype.writeUInt8=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,1,255,0),$e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},$e.prototype.writeUInt16LE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,2,65535,0),$e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):bo(this,t,r,!0),r+2},$e.prototype.writeUInt16BE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,2,65535,0),$e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):bo(this,t,r,!1),r+2},$e.prototype.writeUInt32LE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,4,4294967295,0),$e.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):mo(this,t,r,!0),r+4},$e.prototype.writeUInt32BE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,4,4294967295,0),$e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):mo(this,t,r,!1),r+4},$e.prototype.writeIntLE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);wo(this,t,r,n,o-1,-o)}var i=0,u=1,a=0;for(this[r]=255&t;++i>0)-a&255;return r+n},$e.prototype.writeIntBE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);wo(this,t,r,n,o-1,-o)}var i=n-1,u=1,a=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+n},$e.prototype.writeInt8=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,1,127,-128),$e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},$e.prototype.writeInt16LE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,2,32767,-32768),$e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):bo(this,t,r,!0),r+2},$e.prototype.writeInt16BE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,2,32767,-32768),$e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):bo(this,t,r,!1),r+2},$e.prototype.writeInt32LE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,4,2147483647,-2147483648),$e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):mo(this,t,r,!0),r+4},$e.prototype.writeInt32BE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),$e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):mo(this,t,r,!1),r+4},$e.prototype.writeFloatLE=function(t,r,n){return Eo(this,t,r,!0,n)},$e.prototype.writeFloatBE=function(t,r,n){return Eo(this,t,r,!1,n)},$e.prototype.writeDoubleLE=function(t,r,n){return _o(this,t,r,!0,n)},$e.prototype.writeDoubleBE=function(t,r,n){return _o(this,t,r,!1,n)},$e.prototype.copy=function(t,r,n,e){if(n||(n=0),e||0===e||(e=this.length),r>=t.length&&(r=t.length),r||(r=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(i<1e3||!$e.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&n<57344){if(!o){if(n>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===e){(r-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(r-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((r-=1)<0)break;i.push(n)}else if(n<2048){if((r-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((r-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Ro(t){return function(t){var r,n,e,o,i,u;Ce||Me();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[a-2]?2:"="===t[a-1]?1:0,u=new xe(3*a/4-i),e=i>0?a-4:a;var f=0;for(r=0,n=0;r>16&255,u[f++]=o>>8&255,u[f++]=255&o;return 2===i?(o=Ye[t.charCodeAt(r)]<<2|Ye[t.charCodeAt(r+1)]>>4,u[f++]=255&o):1===i&&(o=Ye[t.charCodeAt(r)]<<10|Ye[t.charCodeAt(r+1)]<<4|Ye[t.charCodeAt(r+2)]>>2,u[f++]=o>>8&255,u[f++]=255&o),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Oo,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function To(t,r,n,e){for(var o=0;o=r.length||o>=t.length);++o)r[o+n]=t[o];return o}function Uo(t){return null!=t&&(!!t._isBuffer||Io(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Io(t.slice(0,0))}(t))}function Io(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var So=Object.freeze({__proto__:null,Buffer:$e,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),$e.alloc(+t)},isBuffer:Uo,kMaxLength:ze}),Bo=$e;module.exports=Bo;var Yo=Bt,xo=t(Object.freeze({__proto__:null}));var Co=function(){var t,r;if("function"!=typeof xo)return!1;try{r="function"==typeof xo.from?xo.from([1,2,3,4]):new xo([1,2,3,4]),t=Yo(r)&&1===r[0]&&2===r[1]&&3===r[2]&&4===r[3]}catch(r){t=!1}return t},Mo=Co;var Lo=t(So).Buffer,Fo=function(){throw new Error("not implemented")},Do=Mo()?Lo:Fo,No=zt(Do.from),ko=Bt,Vo=Do;var zo=function(t){if(!ko(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return Vo.from(t)},Go=Bt,Xo=Do;var $o=function(t){if(!Go(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return new Xo(t)},Ho=No?zo:$o,Wo=S,qo="function"==typeof Int8Array;var Jo="function"==typeof Int8Array?Int8Array:null,Zo=function(t){return qo&&t instanceof Int8Array||"[object Int8Array]"===Wo(t)},Ko=Jo;var Qo=function(){var t,r;if("function"!=typeof Ko)return!1;try{r=new Ko([1,3.14,-3.14,128]),t=Zo(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t};var ti="function"==typeof Int8Array?Int8Array:void 0,ri=function(){throw new Error("not implemented")},ni=Qo()?ti:ri,ei=S,oi="function"==typeof Uint8Array;var ii="function"==typeof Uint8Array?Uint8Array:null,ui=function(t){return oi&&t instanceof Uint8Array||"[object Uint8Array]"===ei(t)},ai=ii;var fi=function(){var t,r;if("function"!=typeof ai)return!1;try{r=new ai(r=[1,3.14,-3.14,256,257]),t=ui(r)&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var ci="function"==typeof Uint8Array?Uint8Array:void 0,si=function(){throw new Error("not implemented")},li=fi()?ci:si,hi=S,pi="function"==typeof Uint8ClampedArray;var yi="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null,vi=function(t){return pi&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===hi(t)},gi=yi;var wi=function(){var t,r;if("function"!=typeof gi)return!1;try{r=new gi([-1,0,1,3.14,4.99,255,256]),t=vi(r)&&0===r[0]&&0===r[1]&&1===r[2]&&3===r[3]&&5===r[4]&&255===r[5]&&255===r[6]}catch(r){t=!1}return t};var di="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,bi=function(){throw new Error("not implemented")},mi=wi()?di:bi,Ai=S,Ei="function"==typeof Int16Array;var _i="function"==typeof Int16Array?Int16Array:null,Oi=function(t){return Ei&&t instanceof Int16Array||"[object Int16Array]"===Ai(t)},Pi=_i;var ji=function(){var t,r;if("function"!=typeof Pi)return!1;try{r=new Pi([1,3.14,-3.14,32768]),t=Oi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t};var Ri="function"==typeof Int16Array?Int16Array:void 0,Ti=function(){throw new Error("not implemented")},Ui=ji()?Ri:Ti,Ii=S,Si="function"==typeof Uint16Array;var Bi="function"==typeof Uint16Array?Uint16Array:null,Yi=function(t){return Si&&t instanceof Uint16Array||"[object Uint16Array]"===Ii(t)},xi=Bi;var Ci=function(){var t,r;if("function"!=typeof xi)return!1;try{r=new xi(r=[1,3.14,-3.14,65536,65537]),t=Yi(r)&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var Mi="function"==typeof Uint16Array?Uint16Array:void 0,Li=function(){throw new Error("not implemented")},Fi=Ci()?Mi:Li,Di=S,Ni="function"==typeof Int32Array;var ki="function"==typeof Int32Array?Int32Array:null,Vi=function(t){return Ni&&t instanceof Int32Array||"[object Int32Array]"===Di(t)},zi=ki;var Gi=function(){var t,r;if("function"!=typeof zi)return!1;try{r=new zi([1,3.14,-3.14,2147483648]),t=Vi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t};var Xi="function"==typeof Int32Array?Int32Array:void 0,$i=function(){throw new Error("not implemented")},Hi=Gi()?Xi:$i,Wi=S,qi="function"==typeof Uint32Array;var Ji="function"==typeof Uint32Array?Uint32Array:null,Zi=function(t){return qi&&t instanceof Uint32Array||"[object Uint32Array]"===Wi(t)},Ki=Ji;var Qi=function(){var t,r;if("function"!=typeof Ki)return!1;try{r=new Ki(r=[1,3.14,-3.14,4294967296,4294967297]),t=Zi(r)&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var tu="function"==typeof Uint32Array?Uint32Array:void 0,ru=function(){throw new Error("not implemented")},nu=Qi()?tu:ru,eu=S,ou="function"==typeof Float32Array;var iu="function"==typeof Float32Array?Float32Array:null,uu=function(t){return ou&&t instanceof Float32Array||"[object Float32Array]"===eu(t)},au=pr,fu=iu;var cu=function(){var t,r;if("function"!=typeof fu)return!1;try{r=new fu([1,3.14,-3.14,5e40]),t=uu(r)&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===au}catch(r){t=!1}return t};var su="function"==typeof Float32Array?Float32Array:void 0,lu=function(){throw new Error("not implemented")},hu=cu()?su:lu,pu=S,yu="function"==typeof Float64Array;var vu="function"==typeof Float64Array?Float64Array:null,gu=function(t){return yu&&t instanceof Float64Array||"[object Float64Array]"===pu(t)},wu=vu;var du=function(){var t,r;if("function"!=typeof wu)return!1;try{r=new wu([1,3.14,-3.14,NaN]),t=gu(r)&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t};var bu,mu="function"==typeof Float64Array?Float64Array:void 0,Au=function(){throw new Error("not implemented")};bu=du()?mu:Au;var Eu=ni,_u=li,Ou=mi,Pu=Ui,ju=Fi,Ru=Hi,Tu=nu,Uu=hu,Iu=bu;function Su(t){return new Eu(t)}function Bu(t){return new _u(t)}function Yu(t){return new Ou(t)}function xu(t){return new Pu(t)}function Cu(t){return new ju(t)}function Mu(t){return new Ru(t)}function Lu(t){return new Tu(t)}function Fu(t){return new Uu(t)}function Du(t){return new Iu(t)}var Nu=O,ku=Rt,Vu=Bt,zu=tn,Gu=kt,Xu=un,$u=Pn,Hu=_e,Wu=Re,qu=Se,Ju=Zr,Zu=p,Ku=Ho,Qu={int8array:Su,uint8array:Bu,uint8clampedarray:Yu,int16array:xu,uint16array:Cu,int32array:Mu,uint32array:Lu,float32array:Fu,float64array:Du};function ta(t,r,n,e,o){var i,u,a,f,c,s,l,h,p,y;if(o-=1,"object"!=typeof t||null===t)return t;if(Vu(t))return Ku(t);if(zu(t))return function(t){var r,n,e,o,i,u,a=[],f=[];for(i=new t.constructor(t.message),a.push(t),f.push(i),t.stack&&(i.stack=t.stack),t.code&&(i.code=t.code),t.errno&&(i.errno=t.errno),t.syscall&&(i.syscall=t.syscall),r=Hu(t),u=0;u0)for(i=a,y=0;y1){if(!na(r))throw new TypeError("invalid argument. `level` must be a nonnegative integer. Value: `"+r+"`.");if(0===r)return t}else r=ea;return n=ra(t)?new Array(t.length):{},oa(t,n,[t],[n],r)},ua=Rt;var aa=function(t){return"object"==typeof t&&null!==t&&!ua(t)},fa=zt,ca=Zr,sa=O,la=S,ha=Object.prototype;var pa=function(t){var r;return!!aa(t)&&(!(r=ca(t))||!sa(t,"constructor")&&sa(r,"constructor")&&fa(r.constructor)&&"[object Function]"===la(r.constructor)&&sa(r,"isPrototypeOf")&&fa(r.isPrototypeOf)&&(r===ha||function(t){var r;for(r in t)if(!sa(t,r))return!1;return!0}(t)))},ya=pa,va=O,ga=V.isPrimitive;var wa={url:"https://stdlib.io/docs/api/latest/error-decoder.html",message:"Minified stdlib error code: {{code}}. Visit {{url}} for the full message."},da=Kt,ba=ia,ma=function(t,r){return ya(r)?va(r,"url")&&(t.url=r.url,!ga(t.url))?new TypeError("invalid option. `url` option must be a string primitive. Option: `"+t.url+"`."):va(r,"message")&&(t.message=r.message,!ga(t.message))?new TypeError("invalid option. `message` option must be a string primitive. Option: `"+t.message+"`."):null:new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.")},Aa=wa;var Ea=function(t){var r,n;if(r=ba(Aa),n=ma(r,t))throw n;return function(){var t,n,e=arguments[0],o=r.url+"?code="+e;for(n=1;n\n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an object. Value: `' + obj + '`.' );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. Property descriptor must be an object. Value: `' + descriptor + '`.' );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* var defineProperty = require( '@stdlib/utils-define-property' );\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nvar hasDefinePropertySupport = require( './has_define_property_support.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 defineProperty = require( '@stdlib/utils-define-property' );\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define a non-enumerable read-only property.\n*\n* @module @stdlib/utils-define-nonenumerable-read-only-property\n*\n* @example\n* var setNonEnumerableReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\n\n// MODULES //\n\nvar setNonEnumerableReadOnly = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasSymbols = require( '@stdlib/assert-has-symbol-support' );\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `toStringTag` support.\n*\n* @module @stdlib/assert-has-tostringtag-support\n*\n* @example\n* var hasToStringTagSupport = require( '@stdlib/assert-has-tostringtag-support' );\n*\n* var bool = hasToStringTagSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasToStringTagSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nmodule.exports = toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object has a specified property.\n*\n* @module @stdlib/assert-has-own-property\n*\n* @example\n* var hasOwnProp = require( '@stdlib/assert-has-own-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* bool = hasOwnProp( beep, 'bop' );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasOwnProp = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nmodule.exports = toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar toStringTag = require( './tostringtag.js' );\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return a string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* var nativeClass = require( '@stdlib/utils-native-class' );\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar builtin = require( './native_class.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 valueOf = require( './valueof.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2valueof.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' );\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isObject;\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isString = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isString, 'isPrimitive', isPrimitive );\nsetReadOnly( isString, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string primitive\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Escape a regular expression string or pattern.\n*\n* @module @stdlib/utils-escape-regexp-string\n*\n* @example\n* var rescape = require( '@stdlib/utils-escape-regexp-string' );\n*\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\n\n// MODULES //\n\nvar rescape = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar RE = /./;\n\n\n// EXPORTS //\n\nmodule.exports = RE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* var isBoolean = require( '@stdlib/assert-is-boolean' );\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* // Use interface to check for boolean primitives...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* // Use interface to check for boolean objects...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isObject;\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isBoolean = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isBoolean, 'isPrimitive', isPrimitive );\nsetReadOnly( isBoolean, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar obj = ( typeof global === 'object' ) ? global : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar getThis = require( './codegen.js' );\nvar Self = require( './self.js' );\nvar Win = require( './window.js' );\nvar Global = require( './global.js' );\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. Must provide a boolean primitive. Value: `'+codegen+'`.' );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: Node.js\n\tif ( Global ) {\n\t\treturn Global;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 getGlobal = require( '@stdlib/utils-global' );\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nmodule.exports = nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return the global object.\n*\n* @module @stdlib/utils-global\n*\n* @example\n* var getGlobal = require( '@stdlib/utils-global' );\n*\n* var g = getGlobal();\n* // returns {...}\n*/\n\n// MODULES //\n\nvar getGlobal = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 RE = require( './fixtures/re.js' );\nvar nodeList = require( './fixtures/nodelist.js' );\nvar typedarray = require( './fixtures/typedarray.js' );\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Returns a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* var reFunctionName = require( '@stdlib/regexp-function-name' );\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reFunctionName = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reFunctionName, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 reFunctionName = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nmodule.exports = RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nmodule.exports = f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an array.\n*\n* @module @stdlib/assert-is-array\n*\n* @example\n* var isArray = require( '@stdlib/assert-is-array' );\n*\n* var bool = isArray( [] );\n* // returns true\n*\n* bool = isArray( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isArray = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* var isOdd = require( '@stdlib/assert-is-odd' );\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a function. Value: `' + predicate + '`.' );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' );\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' ).isObjectLikeArray;\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar arrayfun = require( '@stdlib/assert-tools-array-function' );\nvar isObjectLike = require( './main.js' );\n\n\n// MAIN //\n\nsetReadOnly( isObjectLike, 'isObjectLikeArray', arrayfun( isObjectLike ) );\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isObjectLike = require( '@stdlib/assert-is-object-like' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a Buffer instance.\n*\n* @module @stdlib/assert-is-buffer\n*\n* @example\n* var isBuffer = require( '@stdlib/assert-is-buffer' );\n*\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* v = isBuffer( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isBuffer = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\nvar RE = require( '@stdlib/regexp-function-name' ).REGEXP;\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine the name of a value's constructor.\n*\n* @module @stdlib/utils-constructor-name\n*\n* @example\n* var constructorName = require( '@stdlib/utils-constructor-name' );\n*\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* v = constructorName( {} );\n* // returns 'Object'\n*\n* v = constructorName( true );\n* // returns 'Boolean'\n*/\n\n// MODULES //\n\nvar constructorName = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* var typeOf = require( '@stdlib/utils-type-of' );\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nvar usePolyfill = require( './check.js' );\nvar typeOf = require( './typeof.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : typeOf;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 typeOf = require( '@stdlib/utils-type-of' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a function.\n*\n* @module @stdlib/assert-is-function\n*\n* @example\n* var isFunction = require( '@stdlib/assert-is-function' );\n*\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\n\n// MODULES //\n\nvar isFunction = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 exec = require( './exec.js' );\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2exec.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 rescape = require( '@stdlib/utils-escape-regexp-string' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isRegExp = require( '@stdlib/assert-is-regexp' );\n\n\n// MAIN //\n\n/**\n* Replace search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string primitive\n* @throws {TypeError} second argument argument must be a string primitive or regular expression\n* @throws {TypeError} third argument must be a string primitive or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* var capitalize = require( '@stdlib/string-capitalize' );\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer);\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be a string primitive. Value: `' + str + '`.' );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = rescape( search );\n\t\tsearch = new RegExp( search, 'g' );\n\t}\n\telse if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( 'invalid argument. Second argument must be a string primitive or regular expression. Value: `' + search + '`.' );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( 'invalid argument. Third argument must be a string primitive or replacement function. Value: `' + newval + '`.' );\n\t}\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Replace search occurrences with a replacement string.\n*\n* @module @stdlib/string-replace\n*\n* @example\n* var replace = require( '@stdlib/string-replace' );\n*\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* str = 'Hello World';\n* out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*/\n\n// MODULES //\n\nvar replace = require( './replace.js' );\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Constructor which returns a `Number` object.\n*\n* @module @stdlib/number-ctor\n*\n* @example\n* var Number = require( '@stdlib/number-ctor' );\n*\n* var v = new Number( 10.0 );\n* // returns \n*/\n\n// MODULES //\n\nvar Number = require( './number.js' );\n\n\n// EXPORTS //\n\nmodule.exports = Number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// EXPORTS //\n\nmodule.exports = Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar Number = require( '@stdlib/number-ctor' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' );\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isObject;\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNumber = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNumber, 'isPrimitive', isPrimitive );\nsetReadOnly( isNumber, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* var FLOAT64_PINF = require( '@stdlib/constants-float64-pinf' );\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* var FLOAT64_NINF = require( '@stdlib/constants-float64-ninf' );\n* // returns -Infinity\n*/\n\n// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 floor = require( '@stdlib/math-base-special-floor' );\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nmodule.exports = floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a finite double-precision floating-point number is an integer.\n*\n* @module @stdlib/math-base-assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/math-base-assert-is-integer' );\n*\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* bool = isInteger( 3.14 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isInteger = require( './is_integer.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 PINF = require( '@stdlib/constants-float64-pinf' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar isInt = require( '@stdlib/math-base-assert-is-integer' );\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/assert-is-integer' );\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' );\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isObject;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNonNegativeInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNonNegativeInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isNonNegativeInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\nvar getProto = require( './proto.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFunction = require( '@stdlib/assert-is-function' );\nvar builtin = require( './native.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 getProto = require( './detect.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return the prototype of a provided object.\n*\n* @module @stdlib/utils-get-prototype-of\n*\n* @example\n* var getPrototype = require( '@stdlib/utils-get-prototype-of' );\n*\n* var proto = getPrototype( {} );\n* // returns {}\n*/\n\n// MODULES //\n\nvar getPrototype = require( './get_prototype_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an `Error` object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `Error` object\n*\n* @example\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isError( {} );\n* // returns false\n*/\nfunction isError( value ) {\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tif ( value instanceof Error ) {\n\t\treturn true;\n\t}\n\t// Walk the prototype tree until we find an object having the desired native class...\n\twhile ( value ) {\n\t\tif ( nativeClass( value ) === '[object Error]' ) {\n\t\t\treturn true;\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `Error` object.\n*\n* @module @stdlib/assert-is-error\n*\n* @example\n* var isError = require( '@stdlib/assert-is-error' );\n*\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* bool = isError( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isError = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Returns a regular expression to parse a regular expression string.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*/\nfunction reRegExp() {\n\treturn /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/; // eslint-disable-line no-useless-escape\n}\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return a regular expression to parse a regular expression string.\n*\n* @module @stdlib/regexp-regexp\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var parts = RE_REGEXP.exec( '/^.*$/ig' );\n* // returns [ '/^.*$/ig', '^.*$', 'ig', 'index': 0, 'input': '/^.*$/ig' ]\n*/\n\n// MAIN //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reRegExp = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reRegExp, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 reRegExp = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Matches parts of a regular expression string.\n*\n* Regular expression: `/^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/`\n*\n* - `/^\\/`\n* - match a string that begins with a `/`\n*\n* - `()`\n* - capture\n*\n* - `(?:)+`\n* - capture, but do not remember, a group of characters which occur one or more times\n*\n* - `\\\\\\/`\n* - match the literal `\\/`\n*\n* - `|`\n* - OR\n*\n* - `[^\\/]`\n* - anything which is not the literal `\\/`\n*\n* - `\\/`\n* - match the literal `/`\n*\n* - `([imgy]*)`\n* - capture any characters matching `imgy` occurring zero or more times\n*\n* - `$/`\n* - string end\n*\n*\n* @constant\n* @type {RegExp}\n* @default /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/\n*/\nvar RE_REGEXP = reRegExp();\n\n\n// EXPORTS //\n\nmodule.exports = RE_REGEXP;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar reRegExp = require( '@stdlib/regexp-regexp' );\n\n\n// MAIN //\n\n/**\n* Parses a regular expression string and returns a new regular expression.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} must provide a regular expression string\n* @returns {(RegExp|null)} regular expression or null\n*\n* @example\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\nfunction reFromString( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Capture the regular expression pattern and any flags:\n\tstr = reRegExp().exec( str );\n\n\t// Create a new regular expression:\n\treturn ( str ) ? new RegExp( str[1], str[2] ) : null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Create a regular expression from a regular expression string.\n*\n* @module @stdlib/utils-regexp-from-string\n*\n* @example\n* var reFromString = require( '@stdlib/utils-regexp-from-string' );\n*\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\n\n// MODULES //\n\nvar reFromString = require( './from_string.js' );\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a double-precision floating-point numeric value is `NaN`.\n*\n* @module @stdlib/math-base-assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/math-base-assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 7.0 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isnan = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is `NaN`.\n*\n* @module @stdlib/assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isObject;\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isnan = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isnan, 'isPrimitive', isPrimitive );\nsetReadOnly( isnan, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isCollection;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isnan = require( '@stdlib/assert-is-nan' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} `fromIndex` must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array-like object. Value: `' + arr + '`.' );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `fromIndex` must be an integer. Value: `' + fromIndex + '`.' );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* var MAX_TYPED_ARRAY_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nmodule.exports = MAX_TYPED_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return the first index at which a given element can be found.\n*\n* @module @stdlib/utils-index-of\n*\n* @example\n* var indexOf = require( '@stdlib/utils-index-of' );\n*\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* arr = [ 4, 3, 2, 1 ];\n* idx = indexOf( arr, 5 );\n* // returns -1\n*\n* // Using a `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* // `fromIndex` which exceeds `array` length:\n* arr = [ 1, 2, 3, 4, 2, 5 ];\n* idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* // Negative `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* // Negative `fromIndex` exceeding input `array` length:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* // Array-like objects:\n* var str = 'bebop';\n* idx = indexOf( str, 'o' );\n* // returns 3\n*/\n\n// MODULES //\n\nvar indexOf = require( './index_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 keys = require( './builtin.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar bool = ( typeof Object.keys !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArguments = require( './main.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isEnum = require( './native.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isString = require( '@stdlib/assert-is-string' );\nvar isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isEnum = require( './native.js' );\nvar hasStringEnumBug = require( './has_string_enumerability_bug.js' );\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object's own property is enumerable.\n*\n* @module @stdlib/assert-is-enumerable-property\n*\n* @example\n* var isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\n\n// MODULES //\n\nvar isEnumerableProperty = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-uint32-max' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* var isArguments = require( '@stdlib/assert-is-arguments' );\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasArgumentsClass = require( './detect.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Maximum unsigned 32-bit integer.\n*\n* @module @stdlib/constants-uint32-max\n* @type {uinteger32}\n*\n* @example\n* var UINT32_MAX = require( '@stdlib/constants-uint32-max' );\n* // returns 4294967295\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111111111111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar UINT32_MAX = 4294967295;\n\n\n// EXPORTS //\n\nmodule.exports = UINT32_MAX;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArguments = require( '@stdlib/assert-is-arguments' );\nvar builtin = require( './builtin.js' );\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nmodule.exports = noop;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar noop = require( '@stdlib/utils-noop' );\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Tests whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isConstructorPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar EXCLUDED_KEYS = require( './excluded_keys.json' );\nvar win = require( './window.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nmodule.exports = w;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar bool = ( typeof window !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasAutomationEqualityBug = require( './has_automation_equality_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar HAS_WINDOW = require( './has_window.js' );\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = wrapper;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isObjectLike = require( '@stdlib/assert-is-object-like' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar HAS_ENUM_PROTO_BUG = require( './has_enumerable_prototype_bug.js' );\nvar HAS_NON_ENUM_PROPS_BUG = require( './has_non_enumerable_properties_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype_wrapper.js' );\nvar NON_ENUMERABLE = require( './non_enumerable.json' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasArgumentsBug = require( './has_arguments_bug.js' );\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar wrapper = require( './builtin_wrapper.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return an array of an object's own enumerable property names.\n*\n* @module @stdlib/utils-keys\n*\n* @example\n* var keys = require( '@stdlib/utils-keys' );\n*\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\n\n// MODULES //\n\nvar keys = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar bool = ( typeof Object.getOwnPropertyNames !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyNames = Object.getOwnPropertyNames;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn propertyNames( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 keys = require( '@stdlib/utils-keys' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n* - In environments lacking support for `Object.getOwnPropertyNames()`, property descriptors are unavailable, and thus all properties can be safely assumed to be enumerable. Hence, we can defer to calling `Object.keys`, which retrieves all own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return an array of an object's own enumerable and non-enumerable property names.\n*\n* @module @stdlib/utils-property-names\n*\n* @example\n* var getOwnPropertyNames = require( '@stdlib/utils-property-names' );\n*\n* var keys = getOwnPropertyNames({\n* 'foo': 'bar',\n* 'beep': 'boop'\n* });\n* // e.g., returns [ 'foo', 'beep' ]\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar bool = ( typeof Object.getOwnPropertyDescriptor !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyDescriptor = Object.getOwnPropertyDescriptor;\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tvar desc;\n\tif ( value === null || value === void 0 ) {\n\t\treturn null;\n\t}\n\tdesc = propertyDescriptor( value, property );\n\treturn ( desc === void 0 ) ? null : desc;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n* - In environments lacking `Object.getOwnPropertyDescriptor()` support, property descriptors do not exist. In non-supporting environment, if an object has a provided property, this function returns a descriptor object equivalent to that returned in a supporting environment; otherwise, the function returns `null`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tif ( hasOwnProp( value, property ) ) {\n\t\treturn {\n\t\t\t'configurable': true,\n\t\t\t'enumerable': true,\n\t\t\t'writable': true,\n\t\t\t'value': value[ property ]\n\t\t};\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return a property descriptor for an object's own property.\n*\n* @module @stdlib/utils-property-descriptor\n*\n* @example\n* var getOwnPropertyDescriptor = require( '@stdlib/utils-property-descriptor' );\n*\n* var obj = {\n* 'foo': 'bar',\n* 'beep': 'boop'\n* };\n*\n* var keys = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':'bar'}\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Buffer === 'function' ) ? Buffer : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isBuffer = require( '@stdlib/assert-is-buffer' );\nvar GlobalBuffer = require( './buffer.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Buffer` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Buffer` support\n*\n* @example\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\nfunction hasNodeBufferSupport() {\n\tvar bool;\n\tvar b;\n\n\tif ( typeof GlobalBuffer !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tif ( typeof GlobalBuffer.from === 'function' ) {\n\t\t\tb = GlobalBuffer.from( [ 1, 2, 3, 4 ] );\n\t\t} else {\n\t\t\tb = new GlobalBuffer( [ 1, 2, 3, 4 ] ); // Note: this is deprecated behavior starting in Node v6 (see https://nodejs.org/api/buffer.html#buffer_new_buffer_array)\n\t\t}\n\t\tbool = (\n\t\t\tisBuffer( b ) &&\n\t\t\tb[ 0 ] === 1 &&\n\t\t\tb[ 1 ] === 2 &&\n\t\t\tb[ 2 ] === 3 &&\n\t\t\tb[ 3 ] === 4\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasNodeBufferSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Buffer` support.\n*\n* @module @stdlib/assert-has-node-buffer-support\n*\n* @example\n* var hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\n*\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasNodeBufferSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write (browser) polyfill\n\n// MAIN //\n\n/**\n* Buffer constructor.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Buffer constructor.\n*\n* @module @stdlib/buffer-ctor\n*\n* @example\n* var ctor = require( '@stdlib/buffer-ctor' );\n*\n* var b = new ctor( [ 1, 2, 3, 4 ] );\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\nvar main = require( './buffer.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasNodeBufferSupport() ) {\n\tctor = main;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = require( 'buffer' ).Buffer; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFunction = require( '@stdlib/assert-is-function' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn Buffer.from( buffer );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn new Buffer( buffer ); // eslint-disable-line no-buffer-constructor\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy buffer data to a new `Buffer` instance.\n*\n* @module @stdlib/buffer-from-buffer\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n* var copyBuffer = require( '@stdlib/buffer-from-buffer' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = copyBuffer( b1 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFrom = require( './has_from.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar copyBuffer;\nif ( hasFrom ) {\n\tcopyBuffer = main;\n} else {\n\tcopyBuffer = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = copyBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' );\nvar INT8_MAX = require( '@stdlib/constants-int8-max' );\nvar INT8_MIN = require( '@stdlib/constants-int8-min' );\nvar GlobalInt8Array = require( './int8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* var INT8_MIN = require( '@stdlib/constants-int8-min' );\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './int8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int8Array` support.\n*\n* @module @stdlib/assert-has-int8array-support\n*\n* @example\n* var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\n*\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isUint8Array = require( '@stdlib/assert-is-uint8array' );\nvar UINT8_MAX = require( '@stdlib/constants-uint8-max' );\nvar GlobalUint8Array = require( './uint8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\nvar builtin = require( './uint8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8Array` support.\n*\n* @module @stdlib/assert-has-uint8array-support\n*\n* @example\n* var hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\n*\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8ClampedArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isUint8ClampedArray = require( '@stdlib/assert-is-uint8clampedarray' );\nvar GlobalUint8ClampedArray = require( './uint8clampedarray.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @module @stdlib/array-uint8c\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8c' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' ); // eslint-disable-line id-length\nvar builtin = require( './uint8clampedarray.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8ClampedArray` support.\n*\n* @module @stdlib/assert-has-uint8clampedarray-support\n*\n* @example\n* var hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' );\n*\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInt16Array = require( '@stdlib/assert-is-int16array' );\nvar INT16_MAX = require( '@stdlib/constants-int16-max' );\nvar INT16_MIN = require( '@stdlib/constants-int16-min' );\nvar GlobalInt16Array = require( './int16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-min\n* @type {integer32}\n*\n* @example\n* var INT16_MIN = require( '@stdlib/constants-int16-min' );\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT16_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int16\n*\n* @example\n* var ctor = require( '@stdlib/array-int16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\nvar builtin = require( './int16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Int16Array === 'function' ) ? Int16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int16Array` support.\n*\n* @module @stdlib/assert-has-int16array-support\n*\n* @example\n* var hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\n*\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isUint16Array = require( '@stdlib/assert-is-uint16array' );\nvar UINT16_MAX = require( '@stdlib/constants-uint16-max' );\nvar GlobalUint16Array = require( './uint16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 16-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint16\n*\n* @example\n* var ctor = require( '@stdlib/array-uint16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\nvar builtin = require( './uint16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Uint16Array === 'function' ) ? Uint16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint16Array` support.\n*\n* @module @stdlib/assert-has-uint16array-support\n*\n* @example\n* var hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\n*\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInt32Array = require( '@stdlib/assert-is-int32array' );\nvar INT32_MAX = require( '@stdlib/constants-int32-max' );\nvar INT32_MIN = require( '@stdlib/constants-int32-min' );\nvar GlobalInt32Array = require( './int32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-min\n* @type {integer32}\n*\n* @example\n* var INT32_MIN = require( '@stdlib/constants-int32-min' );\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT32_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int32\n*\n* @example\n* var ctor = require( '@stdlib/array-int32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\nvar builtin = require( './int32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Int32Array === 'function' ) ? Int32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int32Array` support.\n*\n* @module @stdlib/assert-has-int32array-support\n*\n* @example\n* var hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\n*\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isUint32Array = require( '@stdlib/assert-is-uint32array' );\nvar UINT32_MAX = require( '@stdlib/constants-uint32-max' );\nvar GlobalUint32Array = require( './uint32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 32-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint32\n*\n* @example\n* var ctor = require( '@stdlib/array-uint32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\nvar builtin = require( './uint32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Uint32Array === 'function' ) ? Uint32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint32Array` support.\n*\n* @module @stdlib/assert-has-uint32array-support\n*\n* @example\n* var hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\n*\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFloat32Array = require( '@stdlib/assert-is-float32array' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar GlobalFloat32Array = require( './float32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of single-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float32\n*\n* @example\n* var ctor = require( '@stdlib/array-float32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\nvar builtin = require( './float32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Float32Array === 'function' ) ? Float32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float32Array` support.\n*\n* @module @stdlib/assert-has-float32array-support\n*\n* @example\n* var hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\n*\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat64Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFloat64Array = require( '@stdlib/assert-is-float64array' );\nvar GlobalFloat64Array = require( './float64array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float64\n*\n* @example\n* var ctor = require( '@stdlib/array-float64' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\nvar builtin = require( './float64array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Float64Array === 'function' ) ? Float64Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float64Array` support.\n*\n* @module @stdlib/assert-has-float64array-support\n*\n* @example\n* var hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\n*\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 Int8Array = require( '@stdlib/array-int8' );\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar Uint8ClampedArray = require( '@stdlib/array-uint8c' );\nvar Int16Array = require( '@stdlib/array-int16' );\nvar Uint16Array = require( '@stdlib/array-uint16' );\nvar Int32Array = require( '@stdlib/array-int32' );\nvar Uint32Array = require( '@stdlib/array-uint32' );\nvar Float32Array = require( '@stdlib/array-float32' );\nvar Float64Array = require( '@stdlib/array-float64' );\n\n\n// VARIABLES //\n\nvar hash;\n\n\n// FUNCTIONS //\n\n/**\n* Copies an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - array to copy\n* @returns {Int8Array} new array\n*/\nfunction int8array( arr ) {\n\treturn new Int8Array( arr );\n}\n\n/**\n* Copies a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - array to copy\n* @returns {Uint8Array} new array\n*/\nfunction uint8array( arr ) {\n\treturn new Uint8Array( arr );\n}\n\n/**\n* Copies a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - array to copy\n* @returns {Uint8ClampedArray} new array\n*/\nfunction uint8clampedarray( arr ) {\n\treturn new Uint8ClampedArray( arr );\n}\n\n/**\n* Copies an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - array to copy\n* @returns {Int16Array} new array\n*/\nfunction int16array( arr ) {\n\treturn new Int16Array( arr );\n}\n\n/**\n* Copies a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - array to copy\n* @returns {Uint16Array} new array\n*/\nfunction uint16array( arr ) {\n\treturn new Uint16Array( arr );\n}\n\n/**\n* Copies an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - array to copy\n* @returns {Int32Array} new array\n*/\nfunction int32array( arr ) {\n\treturn new Int32Array( arr );\n}\n\n/**\n* Copies a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - array to copy\n* @returns {Uint32Array} new array\n*/\nfunction uint32array( arr ) {\n\treturn new Uint32Array( arr );\n}\n\n/**\n* Copies a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - array to copy\n* @returns {Float32Array} new array\n*/\nfunction float32array( arr ) {\n\treturn new Float32Array( arr );\n}\n\n/**\n* Copies a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - array to copy\n* @returns {Float64Array} new array\n*/\nfunction float64array( arr ) {\n\treturn new Float64Array( arr );\n}\n\n/**\n* Returns a hash of functions for copying typed arrays.\n*\n* @private\n* @returns {Object} function hash\n*/\nfunction typedarrays() {\n\tvar out = {\n\t\t'int8array': int8array,\n\t\t'uint8array': uint8array,\n\t\t'uint8clampedarray': uint8clampedarray,\n\t\t'int16array': int16array,\n\t\t'uint16array': uint16array,\n\t\t'int32array': int32array,\n\t\t'uint32array': uint32array,\n\t\t'float32array': float32array,\n\t\t'float64array': float64array\n\t};\n\treturn out;\n}\n\n\n// MAIN //\n\nhash = typedarrays();\n\n\n// EXPORTS //\n\nmodule.exports = hash;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar regexp = require( '@stdlib/utils-regexp-from-string' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar propertyNames = require( '@stdlib/utils-property-names' );\nvar propertyDescriptor = require( '@stdlib/utils-property-descriptor' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar defineProperty = require( '@stdlib/utils-define-property' );\nvar copyBuffer = require( '@stdlib/buffer-from-buffer' );\nvar typedArrays = require( './typed_arrays.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Clones a class instance.\n*\n* ## Notes\n*\n* - This should **only** be used for simple cases. Any instances with privileged access to variables (e.g., within closures) cannot be cloned. This approach should be considered **fragile**.\n* - The function is greedy, disregarding the notion of a `level`. Instead, the function deep copies all properties, as we assume the concept of `level` applies only to the class instance reference but not to its internal state. This prevents, in theory, two instances from sharing state.\n*\n*\n* @private\n* @param {Object} val - class instance\n* @returns {Object} new instance\n*/\nfunction cloneInstance( val ) {\n\tvar cache;\n\tvar names;\n\tvar name;\n\tvar refs;\n\tvar desc;\n\tvar tmp;\n\tvar ref;\n\tvar i;\n\n\tcache = [];\n\trefs = [];\n\n\tref = Object.create( getPrototypeOf( val ) );\n\tcache.push( val );\n\trefs.push( ref );\n\n\tnames = propertyNames( val );\n\tfor ( i = 0; i < names.length; i++ ) {\n\t\tname = names[ i ];\n\t\tdesc = propertyDescriptor( val, name );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( val[name] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( val[name], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( ref, name, desc );\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( ref );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( ref );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( ref );\n\t}\n\treturn ref;\n}\n\n/**\n* Copies an error object.\n*\n* @private\n* @param {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error - error to copy\n* @returns {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error copy\n*\n* @example\n* var err1 = new TypeError( 'beep' );\n*\n* var err2 = copyError( err1 );\n* // returns \n*/\nfunction copyError( error ) {\n\tvar cache = [];\n\tvar refs = [];\n\tvar keys;\n\tvar desc;\n\tvar tmp;\n\tvar key;\n\tvar err;\n\tvar i;\n\n\t// Create a new error...\n\terr = new error.constructor( error.message );\n\n\tcache.push( error );\n\trefs.push( err );\n\n\t// If a `stack` property is present, copy it over...\n\tif ( error.stack ) {\n\t\terr.stack = error.stack;\n\t}\n\t// Node.js specific (system errors)...\n\tif ( error.code ) {\n\t\terr.code = error.code;\n\t}\n\tif ( error.errno ) {\n\t\terr.errno = error.errno;\n\t}\n\tif ( error.syscall ) {\n\t\terr.syscall = error.syscall;\n\t}\n\t// Any enumerable properties...\n\tkeys = objectKeys( error );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tdesc = propertyDescriptor( error, key );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( error[ key ] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( error[ key ], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( err, key, desc );\n\t}\n\treturn err;\n}\n\n\n// MAIN //\n\n/**\n* Recursively performs a deep copy of an input object.\n*\n* @private\n* @param {*} val - value to copy\n* @param {(Array|Object)} copy - copy\n* @param {Array} cache - an array of visited objects\n* @param {Array} refs - an array of object references\n* @param {NonNegativeInteger} level - copy depth\n* @returns {*} deep copy\n*/\nfunction deepCopy( val, copy, cache, refs, level ) {\n\tvar parent;\n\tvar keys;\n\tvar name;\n\tvar desc;\n\tvar ctor;\n\tvar key;\n\tvar ref;\n\tvar x;\n\tvar i;\n\tvar j;\n\n\tlevel -= 1;\n\n\t// Primitives and functions...\n\tif (\n\t\ttypeof val !== 'object' ||\n\t\tval === null\n\t) {\n\t\treturn val;\n\t}\n\tif ( isBuffer( val ) ) {\n\t\treturn copyBuffer( val );\n\t}\n\tif ( isError( val ) ) {\n\t\treturn copyError( val );\n\t}\n\t// Objects...\n\tname = typeOf( val );\n\n\tif ( name === 'date' ) {\n\t\treturn new Date( +val );\n\t}\n\tif ( name === 'regexp' ) {\n\t\treturn regexp( val.toString() );\n\t}\n\tif ( name === 'set' ) {\n\t\treturn new Set( val );\n\t}\n\tif ( name === 'map' ) {\n\t\treturn new Map( val );\n\t}\n\tif (\n\t\tname === 'string' ||\n\t\tname === 'boolean' ||\n\t\tname === 'number'\n\t) {\n\t\t// If provided an `Object`, return an equivalent primitive!\n\t\treturn val.valueOf();\n\t}\n\tctor = typedArrays[ name ];\n\tif ( ctor ) {\n\t\treturn ctor( val );\n\t}\n\t// Class instances...\n\tif (\n\t\tname !== 'array' &&\n\t\tname !== 'object'\n\t) {\n\t\t// Cloning requires ES5 or higher...\n\t\tif ( typeof Object.freeze === 'function' ) {\n\t\t\treturn cloneInstance( val );\n\t\t}\n\t\treturn {};\n\t}\n\t// Arrays and plain objects...\n\tkeys = objectKeys( val );\n\tif ( level > 0 ) {\n\t\tparent = name;\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tx = val[ key ];\n\n\t\t\t// Primitive, Buffer, special class instance...\n\t\t\tname = typeOf( x );\n\t\t\tif (\n\t\t\t\ttypeof x !== 'object' ||\n\t\t\t\tx === null ||\n\t\t\t\t(\n\t\t\t\t\tname !== 'array' &&\n\t\t\t\t\tname !== 'object'\n\t\t\t\t) ||\n\t\t\t\tisBuffer( x )\n\t\t\t) {\n\t\t\t\tif ( parent === 'object' ) {\n\t\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\t\tdesc.value = deepCopy( x );\n\t\t\t\t\t}\n\t\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t\t} else {\n\t\t\t\t\tcopy[ key ] = deepCopy( x );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Circular reference...\n\t\t\ti = indexOf( cache, x );\n\t\t\tif ( i !== -1 ) {\n\t\t\t\tcopy[ key ] = refs[ i ];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Plain array or object...\n\t\t\tref = ( isArray( x ) ) ? new Array( x.length ) : {};\n\t\t\tcache.push( x );\n\t\t\trefs.push( ref );\n\t\t\tif ( parent === 'array' ) {\n\t\t\t\tcopy[ key ] = deepCopy( x, ref, cache, refs, level );\n\t\t\t} else {\n\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\tdesc.value = deepCopy( x, ref, cache, refs, level );\n\t\t\t\t}\n\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t}\n\t\t}\n\t} else if ( name === 'array' ) {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tcopy[ key ] = val[ key ];\n\t\t}\n\t} else {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\tdefineProperty( copy, key, desc );\n\t\t}\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( copy );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( copy );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( copy );\n\t}\n\treturn copy;\n}\n\n\n// EXPORTS //\n\nmodule.exports = deepCopy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArray = require( '@stdlib/assert-is-array' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar deepCopy = require( './deep_copy.js' );\n\n\n// MAIN //\n\n/**\n* Copies or deep clones a value to an arbitrary depth.\n*\n* @param {*} value - value to copy\n* @param {NonNegativeInteger} [level=+infinity] - copy depth\n* @throws {TypeError} `level` must be a nonnegative integer\n* @returns {*} value copy\n*\n* @example\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ { 'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\nfunction copy( value, level ) {\n\tvar out;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( level ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `level` must be a nonnegative integer. Value: `' + level + '`.' );\n\t\t}\n\t\tif ( level === 0 ) {\n\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tlevel = PINF;\n\t}\n\tout = ( isArray( value ) ) ? new Array( value.length ) : {};\n\treturn deepCopy( value, out, [value], [out], level );\n}\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy or deep clone a value to an arbitrary depth.\n*\n* @module @stdlib/utils-copy\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ {'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\n\n// MODULES //\n\nvar copy = require( './copy.js' );\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {(Error|null)} error object or null\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );\n\t}\n\tif ( hasOwnProp( options, 'url' ) ) {\n\t\topts.url = options.url;\n\t\tif ( !isString( opts.url ) ) {\n\t\t\treturn new TypeError( 'invalid option. `url` option must be a string primitive. Option: `' + opts.url + '`.' );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'message' ) ) {\n\t\topts.message = options.message;\n\t\tif ( !isString( opts.message ) ) {\n\t\t\treturn new TypeError( 'invalid option. `message` option must be a string primitive. Option: `' + opts.message + '`.' );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a plain object.\n*\n* @module @stdlib/assert-is-plain-object\n*\n* @example\n* var isPlainObject = require( '@stdlib/assert-is-plain-object' );\n*\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* bool = isPlainObject( null );\n* // returns false\n*/\n\n// MODULES //\n\nvar isPlainObject = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 replace = require( '@stdlib/string-replace' );\nvar copy = require( '@stdlib/utils-copy' );\nvar validate = require( './validate.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function which formats an error message for production.\n*\n* @param {Options} options - function options\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {Function} error formatting function\n*\n* @example\n* var opts = {\n* 'url': 'https://stdlib.io/error-decoder.html'\n* };\n*\n* var fcn = factory( opts );\n* // returns \n*/\nfunction factory( options ) {\n\tvar opts;\n\tvar err;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\treturn formatProdErrorMessage;\n\n\t/**\n\t* Formats an error message for production.\n\t*\n\t* @private\n\t* @param {string} code - error code\n\t* @param {*} ...args - error message arguments\n\t* @returns {string} formatted error message\n\t*/\n\tfunction formatProdErrorMessage() {\n\t\tvar code = arguments[ 0 ];\n\t\tvar url = opts.url + '?code='+code;\n\t\tvar msg;\n\t\tvar i;\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\turl += '&arg[]=' + encodeURIComponent( arguments[ i ] );\n\t\t}\n\t\tmsg = replace( opts.message, '{{url}}', url );\n\t\tmsg = replace( msg, '{{code}}', code );\n\t\treturn msg;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Format an error message for production.\n*\n* @module @stdlib/error-tools-fmtprodmsg\n*\n* @example\n* var formatProdErrorMessage = require( '@stdlib/error-tools-fmtprodmsg' );\n*\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar formatProdErrorMessage = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( formatProdErrorMessage, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 factory = require( './factory.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @name formatProdErrorMessage\n* @type {Function}\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\nvar formatProdErrorMessage = factory( defaults );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strides2offset;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @module @stdlib/ndarray-strides2offset\n*\n* @example\n* var strides2offset = require( '@stdlib/ndarray-base-strides2offset' );\n*\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\n\n// MODULES //\n\nvar strides2offset = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = strides2offset;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset' ;\n\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array' ;\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n"],"names":["defineProperty","Object","has_define_property_support","err","builtin","objectProtoype","prototype","toStr","toString","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","polyfill","obj","prop","descriptor","hasValue","hasGet","hasSet","call","TypeError","__proto__","value","Error","get","set","require$$1","require$$2","lib","require$$0","main","configurable","enumerable","writable","primitive","FLG","Symbol","hasSymbols","toStringTag","tostring","native_class","v","has","hasOwnProperty","property","toStrTag","hasOwnProp","isOwn","tag","out","valueOf","String","nativeClass","test","object","isPrimitive","isObject","setReadOnly","isString","require$$3","RE_CHARS","str","s","i","length","replace","substring","re","Boolean","isBoolean","codegen","Function","self_1","self","window_1","window","global","module","exports","getThis","Self","Win","Global","arguments","root","nodeList","document","childNodes","typedarray","Int8Array","RE","check_1","reFunctionName","Array","isArray","isObjectLike","predicate","len","arrayfun","_isBuffer","constructor","isBuffer","REGEXP","match","name","ctor","slice","exec","ctorName","typeOf","type","toLowerCase","RegExp","rescape","isFunction","isRegExp","search","newval","Number","isNumber","POSITIVE_INFINITY","NEGATIVE_INFINITY","floor","Math","x","PINF","NINF","isInt","integer","isInteger","isNonNegativeInteger","getProto","getPrototypeOf","proto","reRegExp","isNan","isnan","isCollection","arr","searchElement","fromIndex","keys","has_arguments_bug","has_builtin","isArguments","bool","detect_1","detect","native","propertyIsEnumerable","isEnum","hasStringEnumBug","isEnumerableProperty","builtin_wrapper","has_enumerable_prototype_bug","has_non_enumerable_properties_bug","is_constructor_prototype","w","indexOf","isConstructorPrototype","EXCLUDED_KEYS","win","k","check","hasAutomationEqualityBug","HAS_WINDOW","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","require$$4","error","NON_ENUMERABLE","wrapper","skipConstructor","skipPrototype","isFcn","p","push","getOwnPropertyNames","propertyNames","getOwnPropertyDescriptor","propertyDescriptor","desc","Buffer","GlobalBuffer","b","from","buffer","hasInt8Array","isInt8Array","GlobalInt8Array","INT8_MAX","hasUint8Array","Uint8Array","isUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ClampedArray","Uint8ClampedArray","isUint8ClampedArray","GlobalUint8ClampedArray","hasInt16Array","Int16Array","isInt16Array","GlobalInt16Array","INT16_MAX","hasUint16Array","Uint16Array","isUint16Array","GlobalUint16Array","UINT16_MAX","hasInt32Array","Int32Array","isInt32Array","GlobalInt32Array","INT32_MAX","hasUint32Array","Uint32Array","isUint32Array","GlobalUint32Array","UINT32_MAX","hasFloat32Array","Float32Array","isFloat32Array","GlobalFloat32Array","hasFloat64Array","Float64Array","isFloat64Array","GlobalFloat64Array","NaN","require$$5","require$$6","require$$7","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","isError","regexp","objectKeys","require$$8","require$$9","require$$10","require$$11","copyBuffer","require$$12","typedArrays","deepCopy","val","copy","cache","refs","level","parent","key","ref","j","tmp","message","stack","code","errno","syscall","copyError","Date","Set","Map","freeze","names","create","isExtensible","preventExtensions","isSealed","seal","isFrozen","cloneInstance","objectPrototype","isPrototypeOf","ownProps","validate","opts","options","url","defaults","factory_1","msg","encodeURIComponent","formatProdErrorMessage","shape","strides","offset","ndims","transpose","sh","st","N","format","dtype","data","strides2offset","order"],"mappings":"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"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 6ce4516..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From eae92a4163c0024ffaf2c795c31bf0d4bfaa2e33 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 02:03:19 +0000 Subject: [PATCH 007/131] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 33 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 681 ------ .github/workflows/publish.yml | 157 -- .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 30 +- benchmark/benchmark.js | 294 --- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 905 ------- 49 files changed, 2705 insertions(+), 5647 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 6add8c2..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-07-01T00:46:40.356Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 128c22e..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,681 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the repository: - push: - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf - - git add -A - git commit -m "Remove files" - - git merge -s recursive -X theirs origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch or create new branch tag: - - name: 'Push changes to `deno` branch or create new branch tag' - run: | - SLUG=${{ github.repository }} - VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p') - if [ -z "$VERSION" ]; then - echo "Workflow job was not triggered by a new tag...." - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - else - echo "Workflow job was triggered by a new tag: $VERSION" - echo "Creating new bundle branch tag of the form $VERSION-deno" - git tag -a $VERSION-deno -m "$VERSION-deno" - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno - fi - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs rm -rf - - git add -A - git commit -m "Remove files" - - git merge -s recursive -X theirs origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 2d5835813f8e178590870c3c389aa27865ba1caf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 18:33:32 +0000 Subject: [PATCH 008/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 330ad01..05f4ab1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 5139e9e5678763fa5b333ae9bb49084ff1ba8b9e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 18:45:38 +0000 Subject: [PATCH 009/131] Remove files --- mod.d.ts | 394 -------- mod.js | 4 - mod.js.map | 1 - stats.html | 2689 ---------------------------------------------------- 4 files changed, 3088 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 78692ff..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function t(t){var r=t.default;if("function"==typeof r){var n=function(){return r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var e=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,e.get?e:{enumerable:!0,get:function(){return t[r]}})})),n}var r="function"==typeof Object.defineProperty?Object.defineProperty:null;var n=function(){try{return r({},"x",{}),!0}catch(t){return!1}},e=Object.defineProperty,o=Object.prototype,i=o.toString,u=o.__defineGetter__,a=o.__defineSetter__,f=o.__lookupGetter__,c=o.__lookupSetter__;var s=function(t,r,n){var e,s,l,h;if("object"!=typeof t||null===t||"[object Array]"===i.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof n||null===n||"[object Array]"===i.call(n))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+n+"`.");if((s="value"in n)&&(f.call(t,r)||c.call(t,r)?(e=t.__proto__,t.__proto__=o,delete t[r],t[r]=n.value,t.__proto__=e):t[r]=n.value),l="get"in n,h="set"in n,s&&(l||h))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return l&&u&&u.call(t,r,n.get),h&&a&&a.call(t,r,n.set),t},l=e,h=s,p=n()?l:h,y=p;var v=function(t,r,n){y(t,r,{configurable:!1,enumerable:!1,writable:!1,value:n})},g=v;var w=function(t){return"string"==typeof t};var d=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}();var b=function(){return d&&"symbol"==typeof Symbol.toStringTag},m=Object.prototype.toString,A=m;var E=function(t){return A.call(t)},_=Object.prototype.hasOwnProperty;var O=function(t,r){return null!=t&&_.call(t,r)},P="function"==typeof Symbol?Symbol.toStringTag:"",j=O,R=P,T=m;var U=E,I=function(t){var r,n,e;if(null==t)return T.call(t);n=t[R],r=j(t,R);try{t[R]=void 0}catch(r){return T.call(t)}return e=T.call(t),r?t[R]=n:delete t[R],e},S=b()?I:U,B=String.prototype.valueOf;var Y=S,x=function(t){try{return B.call(t),!0}catch(t){return!1}},C=b();var M=function(t){return"object"==typeof t&&(t instanceof String||(C?x(t):"[object String]"===Y(t)))},L=w,F=M;var D=g,N=function(t){return L(t)||F(t)},k=M;D(N,"isPrimitive",w),D(N,"isObject",k);var V=N,z=V.isPrimitive,G=/[-\/\\^$*+?.()|[\]{}]/g;var X=function(t){var r,n;if(!z(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");if("/"===t[0])for(n=t.length-1;n>=0&&"/"!==t[n];n--);return void 0===n||n<=0?t.replace(G,"\\$&"):(r=(r=t.substring(1,n)).replace(G,"\\$&"),t=t[0]+r+t.substring(n))},$=/./;var H=function(t){return"boolean"==typeof t},W=Boolean.prototype.toString;var q=S,J=function(t){try{return W.call(t),!0}catch(t){return!1}},Z=b();var K=function(t){return"object"==typeof t&&(t instanceof Boolean||(Z?J(t):"[object Boolean]"===q(t)))},Q=H,tt=K;var rt=g,nt=function(t){return Q(t)||tt(t)},et=K;rt(nt,"isPrimitive",H),rt(nt,"isObject",et);var ot=nt;var it=function(){return new Function("return this;")()},ut="object"==typeof self?self:null,at="object"==typeof window?window:null,ft="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},ct="object"==typeof ft?ft:null;module.exports=ct;var st=ot.isPrimitive,lt=it,ht=ut,pt=at,yt=t(Object.freeze({__proto__:null}));var vt=function(t){if(arguments.length){if(!st(t))throw new TypeError("invalid argument. Must provide a boolean primitive. Value: `"+t+"`.");if(t)return lt()}if(ht)return ht;if(pt)return pt;if(yt)return yt;throw new Error("unexpected error. Unable to resolve global object.")},gt=vt(),wt=gt.document&>.document.childNodes,dt=Int8Array,bt=$,mt=wt,At=dt;var Et=function(){return"function"==typeof bt||"object"==typeof At||"function"==typeof mt};var _t=function(){return/^\s*function\s*([^(]*)/i},Ot=_t;g(Ot,"REGEXP",_t());var Pt=Ot,jt=S;var Rt=Array.isArray?Array.isArray:function(t){return"[object Array]"===jt(t)},Tt=Rt;var Ut=function(t){return null!==t&&"object"==typeof t};g(Ut,"isObjectLikeArray",function(t){if("function"!=typeof t)throw new TypeError("invalid argument. Must provide a function. Value: `"+t+"`.");return function(r){var n,e;if(!Tt(r))return!1;if(0===(n=r.length))return!1;for(e=0;edr&&br(t)},Ar=hr.isPrimitive,Er=mr;var _r=function(t){return Ar(t)&&Er(t)},Or=hr.isObject,Pr=mr;var jr=function(t){return Or(t)&&Pr(t.valueOf())},Rr=_r,Tr=jr;var Ur=g,Ir=function(t){return Rr(t)||Tr(t)},Sr=jr;Ur(Ir,"isPrimitive",_r),Ur(Ir,"isObject",Sr);var Br=Ir,Yr=Br.isPrimitive;var xr=function(t){return Yr(t)&&t>=0},Cr=Br.isObject;var Mr=function(t){return Cr(t)&&t.valueOf()>=0},Lr=xr,Fr=Mr;var Dr=g,Nr=function(t){return Lr(t)||Fr(t)},kr=Mr;Dr(Nr,"isPrimitive",xr),Dr(Nr,"isObject",kr);var Vr=Nr,zr=Object.getPrototypeOf;var Gr=function(t){return t.__proto__},Xr=S,$r=Gr;var Hr=function(t){var r=$r(t);return r||null===r?r:"[object Function]"===Xr(t.constructor)?t.constructor.prototype:t instanceof Object?Object.prototype:null},Wr=zr,qr=Hr,Jr=zt(Object.getPrototypeOf)?Wr:qr;var Zr=function(t){return null==t?null:(t=Object(t),Jr(t))},Kr=Zr,Qr=S;var tn=function(t){if("object"!=typeof t||null===t)return!1;if(t instanceof Error)return!0;for(;t;){if("[object Error]"===Qr(t))return!0;t=Kr(t)}return!1};var rn=function(){return/^\/((?:\\\/|[^\/])+)\/([imgy]*)$/},nn=rn;g(nn,"REGEXP",rn());var en=V.isPrimitive,on=nn;var un=function(t){if(!en(t))throw new TypeError("invalid argument. Must provide a regular expression string. Value: `"+t+"`.");return(t=on().exec(t))?new RegExp(t[1],t[2]):null};var an=function(t){return t!=t},fn=hr.isPrimitive,cn=an;var sn=function(t){return fn(t)&&cn(t)},ln=hr.isObject,hn=an;var pn=function(t){return ln(t)&&hn(t.valueOf())},yn=sn,vn=pn;var gn=g,wn=function(t){return yn(t)||vn(t)},dn=pn;gn(wn,"isPrimitive",sn),gn(wn,"isObject",dn);var bn=wn,mn=gr;var An=bn,En=function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.length&&mn(t.length)&&t.length>=0&&t.length<=9007199254740991},_n=V.isPrimitive,On=Br.isPrimitive;var Pn=function(t,r,n){var e,o;if(!En(t)&&!_n(t))throw new TypeError("invalid argument. First argument must be an array-like object. Value: `"+t+"`.");if(0===(e=t.length))return-1;if(3===arguments.length){if(!On(n))throw new TypeError("invalid argument. `fromIndex` must be an integer. Value: `"+n+"`.");if(n>=0){if(n>=e)return-1;o=n}else(o=e+n)<0&&(o=0)}else o=0;if(An(r)){for(;o=0&&r=0&&t.length<=4294967295&&zn(t,"callee")&&!Gn(t,"callee")},Wn=Hn,qn=jn,Jn=Array.prototype.slice;var Zn=function(t){return Wn(t)?qn(Jn.call(t)):qn(t)};var Kn=Vn((function(){}),"prototype"),Qn=!Vn({toString:null},"toString");var te,re=function(t){return t.constructor&&t.constructor.prototype===t},ne="undefined"==typeof window?void 0:window,ee=O,oe=Pn,ie=kt,ue=re,ae=["console","external","frame","frameElement","frames","innerHeight","innerWidth","outerHeight","outerWidth","pageXOffset","pageYOffset","parent","scrollLeft","scrollTop","scrollX","scrollY","self","webkitIndexedDB","webkitStorageInfo","window"],fe=ne;te=function(){var t;if("undefined"===ie(fe))return!1;for(t in fe)try{-1===oe(ae,t)&&ee(fe,t)&&null!==fe[t]&&"object"===ie(fe[t])&&ue(fe[t])}catch(t){return!0}return!1}();var ce="undefined"!=typeof window,se=te,le=re,he=ce;var pe=It,ye=O,ve=Hn,ge=Kn,we=Qn,de=function(t){if(!1===he&&!se)return le(t);try{return le(t)}catch(t){return!1}},be=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];var me=jn,Ae=Zn,Ee=function(t){var r,n,e,o,i,u,a;if(o=[],ve(t)){for(a=0;a0&&!ye(t,"0"))for(a=0;a>18&63]+Be[o>>12&63]+Be[o>>6&63]+Be[63&o]);return i.join("")}function Fe(t){var r;Ce||Me();for(var n=t.length,e=n%3,o="",i=[],u=16383,a=0,f=n-e;af?f:a+u));return 1===e?(r=t[n-1],o+=Be[r>>2],o+=Be[r<<4&63],o+="=="):2===e&&(r=(t[n-2]<<8)+t[n-1],o+=Be[r>>10],o+=Be[r>>4&63],o+=Be[r<<2&63],o+="="),i.push(o),i.join("")}function De(t,r,n,e,o){var i,u,a=8*o-e-1,f=(1<>1,s=-7,l=n?o-1:0,h=n?-1:1,p=t[r+l];for(l+=h,i=p&(1<<-s)-1,p>>=-s,s+=a;s>0;i=256*i+t[r+l],l+=h,s-=8);for(u=i&(1<<-s)-1,i>>=-s,s+=e;s>0;u=256*u+t[r+l],l+=h,s-=8);if(0===i)i=1-c;else{if(i===f)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,e),i-=c}return(p?-1:1)*u*Math.pow(2,i-e)}function Ne(t,r,n,e,o,i){var u,a,f,c=8*i-o-1,s=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=e?0:i-1,y=e?1:-1,v=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=s):(u=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-u))<1&&(u--,f*=2),(r+=u+l>=1?h/f:h*Math.pow(2,1-l))*f>=2&&(u++,f/=2),u+l>=s?(a=0,u=s):u+l>=1?(a=(r*f-1)*Math.pow(2,o),u+=l):(a=r*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[n+p]=255&a,p+=y,a/=256,o-=8);for(u=u<0;t[n+p]=255&u,p+=y,u/=256,c-=8);t[n+p-y]|=128*v}var ke={}.toString,Ve=Array.isArray||function(t){return"[object Array]"==ke.call(t)};$e.TYPED_ARRAY_SUPPORT=void 0===ft.TYPED_ARRAY_SUPPORT||ft.TYPED_ARRAY_SUPPORT;var ze=Ge();function Ge(){return $e.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Xe(t,r){if(Ge()=Ge())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ge().toString(16)+" bytes");return 0|t}function Ke(t){return!(null==t||!t._isBuffer)}function Qe(t,r){if(Ke(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return jo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Ro(t).length;default:if(e)return jo(t).length;r=(""+r).toLowerCase(),e=!0}}function to(t,r,n){var e=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return yo(this,r,n);case"utf8":case"utf-8":return lo(this,r,n);case"ascii":return ho(this,r,n);case"latin1":case"binary":return po(this,r,n);case"base64":return so(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vo(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),e=!0}}function ro(t,r,n){var e=t[r];t[r]=t[n],t[n]=e}function no(t,r,n,e,o){if(0===t.length)return-1;if("string"==typeof n?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=$e.from(r,e)),Ke(r))return 0===r.length?-1:eo(t,r,n,e,o);if("number"==typeof r)return r&=255,$e.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):eo(t,[r],n,e,o);throw new TypeError("val must be string, number or Buffer")}function eo(t,r,n,e,o){var i,u=1,a=t.length,f=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(t.length<2||r.length<2)return-1;u=2,a/=2,f/=2,n/=2}function c(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var s=-1;for(i=n;ia&&(n=a-f),i=n;i>=0;i--){for(var l=!0,h=0;ho&&(e=o):e=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");e>i/2&&(e=i/2);for(var u=0;u>8,o=n%256,i.push(o),i.push(e);return i}(r,t.length-n),t,n,e)}function so(t,r,n){return 0===r&&n===t.length?Fe(t):Fe(t.slice(r,n))}function lo(t,r,n){n=Math.min(t.length,n);for(var e=[],o=r;o239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(s=c);break;case 2:128==(192&(i=t[o+1]))&&(f=(31&c)<<6|63&i)>127&&(s=f);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(f=(15&c)<<12|(63&i)<<6|63&u)>2047&&(f<55296||f>57343)&&(s=f);break;case 4:i=t[o+1],u=t[o+2],a=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&(f=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&a)>65535&&f<1114112&&(s=f)}null===s?(s=65533,l=1):s>65535&&(s-=65536,e.push(s>>>10&1023|55296),s=56320|1023&s),e.push(s),o+=l}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var n="",e=0;for(;e0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},$e.prototype.compare=function(t,r,n,e,o){if(!Ke(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===e&&(e=0),void 0===o&&(o=this.length),r<0||n>t.length||e<0||o>this.length)throw new RangeError("out of range index");if(e>=o&&r>=n)return 0;if(e>=o)return-1;if(r>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(e>>>=0),u=(n>>>=0)-(r>>>=0),a=Math.min(i,u),f=this.slice(e,o),c=t.slice(r,n),s=0;so)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var i=!1;;)switch(e){case"hex":return oo(this,t,r,n);case"utf8":case"utf-8":return io(this,t,r,n);case"ascii":return uo(this,t,r,n);case"latin1":case"binary":return ao(this,t,r,n);case"base64":return fo(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return co(this,t,r,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),i=!0}},$e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ho(t,r,n){var e="";n=Math.min(t.length,n);for(var o=r;oe)&&(n=e);for(var o="",i=r;in)throw new RangeError("Trying to access beyond buffer length")}function wo(t,r,n,e,o,i){if(!Ke(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function bo(t,r,n,e){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-n,2);o>>8*(e?o:1-o)}function mo(t,r,n,e){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-n,4);o>>8*(e?o:3-o)&255}function Ao(t,r,n,e,o,i){if(n+e>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Eo(t,r,n,e,o){return o||Ao(t,0,n,4),Ne(t,r,n,e,23,4),n+4}function _o(t,r,n,e,o){return o||Ao(t,0,n,8),Ne(t,r,n,e,52,8),n+8}$e.prototype.slice=function(t,r){var n,e=this.length;if((t=~~t)<0?(t+=e)<0&&(t=0):t>e&&(t=e),(r=void 0===r?e:~~r)<0?(r+=e)<0&&(r=0):r>e&&(r=e),r0&&(o*=256);)e+=this[t+--r]*o;return e},$e.prototype.readUInt8=function(t,r){return r||go(t,1,this.length),this[t]},$e.prototype.readUInt16LE=function(t,r){return r||go(t,2,this.length),this[t]|this[t+1]<<8},$e.prototype.readUInt16BE=function(t,r){return r||go(t,2,this.length),this[t]<<8|this[t+1]},$e.prototype.readUInt32LE=function(t,r){return r||go(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},$e.prototype.readUInt32BE=function(t,r){return r||go(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},$e.prototype.readIntLE=function(t,r,n){t|=0,r|=0,n||go(t,r,this.length);for(var e=this[t],o=1,i=0;++i=(o*=128)&&(e-=Math.pow(2,8*r)),e},$e.prototype.readIntBE=function(t,r,n){t|=0,r|=0,n||go(t,r,this.length);for(var e=r,o=1,i=this[t+--e];e>0&&(o*=256);)i+=this[t+--e]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},$e.prototype.readInt8=function(t,r){return r||go(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},$e.prototype.readInt16LE=function(t,r){r||go(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},$e.prototype.readInt16BE=function(t,r){r||go(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},$e.prototype.readInt32LE=function(t,r){return r||go(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},$e.prototype.readInt32BE=function(t,r){return r||go(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},$e.prototype.readFloatLE=function(t,r){return r||go(t,4,this.length),De(this,t,!0,23,4)},$e.prototype.readFloatBE=function(t,r){return r||go(t,4,this.length),De(this,t,!1,23,4)},$e.prototype.readDoubleLE=function(t,r){return r||go(t,8,this.length),De(this,t,!0,52,8)},$e.prototype.readDoubleBE=function(t,r){return r||go(t,8,this.length),De(this,t,!1,52,8)},$e.prototype.writeUIntLE=function(t,r,n,e){(t=+t,r|=0,n|=0,e)||wo(this,t,r,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[r]=255&t;++i=0&&(i*=256);)this[r+o]=t/i&255;return r+n},$e.prototype.writeUInt8=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,1,255,0),$e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},$e.prototype.writeUInt16LE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,2,65535,0),$e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):bo(this,t,r,!0),r+2},$e.prototype.writeUInt16BE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,2,65535,0),$e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):bo(this,t,r,!1),r+2},$e.prototype.writeUInt32LE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,4,4294967295,0),$e.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):mo(this,t,r,!0),r+4},$e.prototype.writeUInt32BE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,4,4294967295,0),$e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):mo(this,t,r,!1),r+4},$e.prototype.writeIntLE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);wo(this,t,r,n,o-1,-o)}var i=0,u=1,a=0;for(this[r]=255&t;++i>0)-a&255;return r+n},$e.prototype.writeIntBE=function(t,r,n,e){if(t=+t,r|=0,!e){var o=Math.pow(2,8*n-1);wo(this,t,r,n,o-1,-o)}var i=n-1,u=1,a=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+n},$e.prototype.writeInt8=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,1,127,-128),$e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},$e.prototype.writeInt16LE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,2,32767,-32768),$e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):bo(this,t,r,!0),r+2},$e.prototype.writeInt16BE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,2,32767,-32768),$e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):bo(this,t,r,!1),r+2},$e.prototype.writeInt32LE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,4,2147483647,-2147483648),$e.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):mo(this,t,r,!0),r+4},$e.prototype.writeInt32BE=function(t,r,n){return t=+t,r|=0,n||wo(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),$e.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):mo(this,t,r,!1),r+4},$e.prototype.writeFloatLE=function(t,r,n){return Eo(this,t,r,!0,n)},$e.prototype.writeFloatBE=function(t,r,n){return Eo(this,t,r,!1,n)},$e.prototype.writeDoubleLE=function(t,r,n){return _o(this,t,r,!0,n)},$e.prototype.writeDoubleBE=function(t,r,n){return _o(this,t,r,!1,n)},$e.prototype.copy=function(t,r,n,e){if(n||(n=0),e||0===e||(e=this.length),r>=t.length&&(r=t.length),r||(r=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(i<1e3||!$e.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=r;i55295&&n<57344){if(!o){if(n>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===e){(r-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(r-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((r-=1)<0)break;i.push(n)}else if(n<2048){if((r-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((r-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Ro(t){return function(t){var r,n,e,o,i,u;Ce||Me();var a=t.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[a-2]?2:"="===t[a-1]?1:0,u=new xe(3*a/4-i),e=i>0?a-4:a;var f=0;for(r=0,n=0;r>16&255,u[f++]=o>>8&255,u[f++]=255&o;return 2===i?(o=Ye[t.charCodeAt(r)]<<2|Ye[t.charCodeAt(r+1)]>>4,u[f++]=255&o):1===i&&(o=Ye[t.charCodeAt(r)]<<10|Ye[t.charCodeAt(r+1)]<<4|Ye[t.charCodeAt(r+2)]>>2,u[f++]=o>>8&255,u[f++]=255&o),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Oo,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function To(t,r,n,e){for(var o=0;o=r.length||o>=t.length);++o)r[o+n]=t[o];return o}function Uo(t){return null!=t&&(!!t._isBuffer||Io(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Io(t.slice(0,0))}(t))}function Io(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var So=Object.freeze({__proto__:null,Buffer:$e,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),$e.alloc(+t)},isBuffer:Uo,kMaxLength:ze}),Bo=$e;module.exports=Bo;var Yo=Bt,xo=t(Object.freeze({__proto__:null}));var Co=function(){var t,r;if("function"!=typeof xo)return!1;try{r="function"==typeof xo.from?xo.from([1,2,3,4]):new xo([1,2,3,4]),t=Yo(r)&&1===r[0]&&2===r[1]&&3===r[2]&&4===r[3]}catch(r){t=!1}return t},Mo=Co;var Lo=t(So).Buffer,Fo=function(){throw new Error("not implemented")},Do=Mo()?Lo:Fo,No=zt(Do.from),ko=Bt,Vo=Do;var zo=function(t){if(!ko(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return Vo.from(t)},Go=Bt,Xo=Do;var $o=function(t){if(!Go(t))throw new TypeError("invalid argument. Must provide a Buffer. Value: `"+t+"`");return new Xo(t)},Ho=No?zo:$o,Wo=S,qo="function"==typeof Int8Array;var Jo="function"==typeof Int8Array?Int8Array:null,Zo=function(t){return qo&&t instanceof Int8Array||"[object Int8Array]"===Wo(t)},Ko=Jo;var Qo=function(){var t,r;if("function"!=typeof Ko)return!1;try{r=new Ko([1,3.14,-3.14,128]),t=Zo(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-128===r[3]}catch(r){t=!1}return t};var ti="function"==typeof Int8Array?Int8Array:void 0,ri=function(){throw new Error("not implemented")},ni=Qo()?ti:ri,ei=S,oi="function"==typeof Uint8Array;var ii="function"==typeof Uint8Array?Uint8Array:null,ui=function(t){return oi&&t instanceof Uint8Array||"[object Uint8Array]"===ei(t)},ai=ii;var fi=function(){var t,r;if("function"!=typeof ai)return!1;try{r=new ai(r=[1,3.14,-3.14,256,257]),t=ui(r)&&1===r[0]&&3===r[1]&&253===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var ci="function"==typeof Uint8Array?Uint8Array:void 0,si=function(){throw new Error("not implemented")},li=fi()?ci:si,hi=S,pi="function"==typeof Uint8ClampedArray;var yi="function"==typeof Uint8ClampedArray?Uint8ClampedArray:null,vi=function(t){return pi&&t instanceof Uint8ClampedArray||"[object Uint8ClampedArray]"===hi(t)},gi=yi;var wi=function(){var t,r;if("function"!=typeof gi)return!1;try{r=new gi([-1,0,1,3.14,4.99,255,256]),t=vi(r)&&0===r[0]&&0===r[1]&&1===r[2]&&3===r[3]&&5===r[4]&&255===r[5]&&255===r[6]}catch(r){t=!1}return t};var di="function"==typeof Uint8ClampedArray?Uint8ClampedArray:void 0,bi=function(){throw new Error("not implemented")},mi=wi()?di:bi,Ai=S,Ei="function"==typeof Int16Array;var _i="function"==typeof Int16Array?Int16Array:null,Oi=function(t){return Ei&&t instanceof Int16Array||"[object Int16Array]"===Ai(t)},Pi=_i;var ji=function(){var t,r;if("function"!=typeof Pi)return!1;try{r=new Pi([1,3.14,-3.14,32768]),t=Oi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-32768===r[3]}catch(r){t=!1}return t};var Ri="function"==typeof Int16Array?Int16Array:void 0,Ti=function(){throw new Error("not implemented")},Ui=ji()?Ri:Ti,Ii=S,Si="function"==typeof Uint16Array;var Bi="function"==typeof Uint16Array?Uint16Array:null,Yi=function(t){return Si&&t instanceof Uint16Array||"[object Uint16Array]"===Ii(t)},xi=Bi;var Ci=function(){var t,r;if("function"!=typeof xi)return!1;try{r=new xi(r=[1,3.14,-3.14,65536,65537]),t=Yi(r)&&1===r[0]&&3===r[1]&&65533===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var Mi="function"==typeof Uint16Array?Uint16Array:void 0,Li=function(){throw new Error("not implemented")},Fi=Ci()?Mi:Li,Di=S,Ni="function"==typeof Int32Array;var ki="function"==typeof Int32Array?Int32Array:null,Vi=function(t){return Ni&&t instanceof Int32Array||"[object Int32Array]"===Di(t)},zi=ki;var Gi=function(){var t,r;if("function"!=typeof zi)return!1;try{r=new zi([1,3.14,-3.14,2147483648]),t=Vi(r)&&1===r[0]&&3===r[1]&&-3===r[2]&&-2147483648===r[3]}catch(r){t=!1}return t};var Xi="function"==typeof Int32Array?Int32Array:void 0,$i=function(){throw new Error("not implemented")},Hi=Gi()?Xi:$i,Wi=S,qi="function"==typeof Uint32Array;var Ji="function"==typeof Uint32Array?Uint32Array:null,Zi=function(t){return qi&&t instanceof Uint32Array||"[object Uint32Array]"===Wi(t)},Ki=Ji;var Qi=function(){var t,r;if("function"!=typeof Ki)return!1;try{r=new Ki(r=[1,3.14,-3.14,4294967296,4294967297]),t=Zi(r)&&1===r[0]&&3===r[1]&&4294967293===r[2]&&0===r[3]&&1===r[4]}catch(r){t=!1}return t};var tu="function"==typeof Uint32Array?Uint32Array:void 0,ru=function(){throw new Error("not implemented")},nu=Qi()?tu:ru,eu=S,ou="function"==typeof Float32Array;var iu="function"==typeof Float32Array?Float32Array:null,uu=function(t){return ou&&t instanceof Float32Array||"[object Float32Array]"===eu(t)},au=pr,fu=iu;var cu=function(){var t,r;if("function"!=typeof fu)return!1;try{r=new fu([1,3.14,-3.14,5e40]),t=uu(r)&&1===r[0]&&3.140000104904175===r[1]&&-3.140000104904175===r[2]&&r[3]===au}catch(r){t=!1}return t};var su="function"==typeof Float32Array?Float32Array:void 0,lu=function(){throw new Error("not implemented")},hu=cu()?su:lu,pu=S,yu="function"==typeof Float64Array;var vu="function"==typeof Float64Array?Float64Array:null,gu=function(t){return yu&&t instanceof Float64Array||"[object Float64Array]"===pu(t)},wu=vu;var du=function(){var t,r;if("function"!=typeof wu)return!1;try{r=new wu([1,3.14,-3.14,NaN]),t=gu(r)&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t};var bu,mu="function"==typeof Float64Array?Float64Array:void 0,Au=function(){throw new Error("not implemented")};bu=du()?mu:Au;var Eu=ni,_u=li,Ou=mi,Pu=Ui,ju=Fi,Ru=Hi,Tu=nu,Uu=hu,Iu=bu;function Su(t){return new Eu(t)}function Bu(t){return new _u(t)}function Yu(t){return new Ou(t)}function xu(t){return new Pu(t)}function Cu(t){return new ju(t)}function Mu(t){return new Ru(t)}function Lu(t){return new Tu(t)}function Fu(t){return new Uu(t)}function Du(t){return new Iu(t)}var Nu=O,ku=Rt,Vu=Bt,zu=tn,Gu=kt,Xu=un,$u=Pn,Hu=_e,Wu=Re,qu=Se,Ju=Zr,Zu=p,Ku=Ho,Qu={int8array:Su,uint8array:Bu,uint8clampedarray:Yu,int16array:xu,uint16array:Cu,int32array:Mu,uint32array:Lu,float32array:Fu,float64array:Du};function ta(t,r,n,e,o){var i,u,a,f,c,s,l,h,p,y;if(o-=1,"object"!=typeof t||null===t)return t;if(Vu(t))return Ku(t);if(zu(t))return function(t){var r,n,e,o,i,u,a=[],f=[];for(i=new t.constructor(t.message),a.push(t),f.push(i),t.stack&&(i.stack=t.stack),t.code&&(i.code=t.code),t.errno&&(i.errno=t.errno),t.syscall&&(i.syscall=t.syscall),r=Hu(t),u=0;u0)for(i=a,y=0;y1){if(!na(r))throw new TypeError("invalid argument. `level` must be a nonnegative integer. Value: `"+r+"`.");if(0===r)return t}else r=ea;return n=ra(t)?new Array(t.length):{},oa(t,n,[t],[n],r)},ua=Rt;var aa=function(t){return"object"==typeof t&&null!==t&&!ua(t)},fa=zt,ca=Zr,sa=O,la=S,ha=Object.prototype;var pa=function(t){var r;return!!aa(t)&&(!(r=ca(t))||!sa(t,"constructor")&&sa(r,"constructor")&&fa(r.constructor)&&"[object Function]"===la(r.constructor)&&sa(r,"isPrototypeOf")&&fa(r.isPrototypeOf)&&(r===ha||function(t){var r;for(r in t)if(!sa(t,r))return!1;return!0}(t)))},ya=pa,va=O,ga=V.isPrimitive;var wa={url:"https://stdlib.io/docs/api/latest/error-decoder.html",message:"Minified stdlib error code: {{code}}. Visit {{url}} for the full message."},da=Kt,ba=ia,ma=function(t,r){return ya(r)?va(r,"url")&&(t.url=r.url,!ga(t.url))?new TypeError("invalid option. `url` option must be a string primitive. Option: `"+t.url+"`."):va(r,"message")&&(t.message=r.message,!ga(t.message))?new TypeError("invalid option. `message` option must be a string primitive. Option: `"+t.message+"`."):null:new TypeError("invalid argument. Options argument must be an object. Value: `"+r+"`.")},Aa=wa;var Ea=function(t){var r,n;if(r=ba(Aa),n=ma(r,t))throw n;return function(){var t,n,e=arguments[0],o=r.url+"?code="+e;for(n=1;n\n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @name defineProperty\n* @type {Function}\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nvar defineProperty = Object.defineProperty;\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an object. Value: `' + obj + '`.' );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( 'invalid argument. Property descriptor must be an object. Value: `' + descriptor + '`.' );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* var defineProperty = require( '@stdlib/utils-define-property' );\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nvar hasDefinePropertySupport = require( './has_define_property_support.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 defineProperty = require( '@stdlib/utils-define-property' );\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define a non-enumerable read-only property.\n*\n* @module @stdlib/utils-define-nonenumerable-read-only-property\n*\n* @example\n* var setNonEnumerableReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\n*\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\n\n// MODULES //\n\nvar setNonEnumerableReadOnly = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Tests for native `Symbol` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol` support\n*\n* @example\n* var bool = hasSymbolSupport();\n* // returns \n*/\nfunction hasSymbolSupport() {\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasSymbols = require( '@stdlib/assert-has-symbol-support' );\n\n\n// VARIABLES //\n\nvar FLG = hasSymbols();\n\n\n// MAIN //\n\n/**\n* Tests for native `toStringTag` support.\n*\n* @returns {boolean} boolean indicating if an environment has `toStringTag` support\n*\n* @example\n* var bool = hasToStringTagSupport();\n* // returns \n*/\nfunction hasToStringTagSupport() {\n\treturn ( FLG && typeof Symbol.toStringTag === 'symbol' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `toStringTag` support.\n*\n* @module @stdlib/assert-has-tostringtag-support\n*\n* @example\n* var hasToStringTagSupport = require( '@stdlib/assert-has-tostringtag-support' );\n*\n* var bool = hasToStringTagSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasToStringTagSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasToStringTagSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar toStr = Object.prototype.toString;\n\n\n// EXPORTS //\n\nmodule.exports = toStr;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification (via the internal property `[[Class]]`) of an object.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\treturn toStr.call( v );\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\nvar has = Object.prototype.hasOwnProperty;\n\n\n// MAIN //\n\n/**\n* Tests if an object has a specified property.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object has a specified property\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'bap' );\n* // returns false\n*/\nfunction hasOwnProp( value, property ) {\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\treturn has.call( value, property );\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object has a specified property.\n*\n* @module @stdlib/assert-has-own-property\n*\n* @example\n* var hasOwnProp = require( '@stdlib/assert-has-own-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = hasOwnProp( beep, 'boop' );\n* // returns true\n*\n* bool = hasOwnProp( beep, 'bop' );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasOwnProp = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasOwnProp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar toStrTag = ( typeof Symbol === 'function' ) ? Symbol.toStringTag : '';\n\n\n// EXPORTS //\n\nmodule.exports = toStrTag;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar toStringTag = require( './tostringtag.js' );\nvar toStr = require( './tostring.js' );\n\n\n// MAIN //\n\n/**\n* Returns a string value indicating a specification defined classification of an object in environments supporting `Symbol.toStringTag`.\n*\n* @param {*} v - input value\n* @returns {string} string value indicating a specification defined classification of the input value\n*\n* @example\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* @example\n* var str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* @example\n* function Beep() {\n* return this;\n* }\n* var str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\nfunction nativeClass( v ) {\n\tvar isOwn;\n\tvar tag;\n\tvar out;\n\n\tif ( v === null || v === void 0 ) {\n\t\treturn toStr.call( v );\n\t}\n\ttag = v[ toStringTag ];\n\tisOwn = hasOwnProp( v, toStringTag );\n\n\t// Attempt to override the `toStringTag` property. For built-ins having a `Symbol.toStringTag` property (e.g., `JSON`, `Math`, etc), the `Symbol.toStringTag` property is read-only (e.g., , so we need to wrap in a `try/catch`.\n\ttry {\n\t\tv[ toStringTag ] = void 0;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn toStr.call( v );\n\t}\n\tout = toStr.call( v );\n\n\tif ( isOwn ) {\n\t\tv[ toStringTag ] = tag;\n\t} else {\n\t\tdelete v[ toStringTag ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return a string value indicating a specification defined classification of an object.\n*\n* @module @stdlib/utils-native-class\n*\n* @example\n* var nativeClass = require( '@stdlib/utils-native-class' );\n*\n* var str = nativeClass( 'a' );\n* // returns '[object String]'\n*\n* str = nativeClass( 5 );\n* // returns '[object Number]'\n*\n* function Beep() {\n* return this;\n* }\n* str = nativeClass( new Beep() );\n* // returns '[object Object]'\n*/\n\n// MODULES //\n\nvar hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar builtin = require( './native_class.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar nativeClass;\nif ( hasToStringTag() ) {\n\tnativeClass = polyfill;\n} else {\n\tnativeClass = builtin;\n}\n\n\n// EXPORTS //\n\nmodule.exports = nativeClass;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 valueOf = require( './valueof.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to extract a string value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a string can be extracted\n*/\nfunction test( value ) {\n\ttry {\n\t\tvalueOf.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar valueOf = String.prototype.valueOf; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = valueOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2valueof.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string object\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns false\n*/\nfunction isString( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof String ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object String]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a string.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a string\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*/\nfunction isString( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a string.\n*\n* @module @stdlib/assert-is-string\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' );\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 5 );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isObject;\n*\n* var bool = isString( new String( 'beep' ) );\n* // returns true\n*\n* bool = isString( 'beep' );\n* // returns false\n*\n* @example\n* var isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n*\n* var bool = isString( 'beep' );\n* // returns true\n*\n* bool = isString( new String( 'beep' ) );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isString = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isString, 'isPrimitive', isPrimitive );\nsetReadOnly( isString, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string primitive\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Escape a regular expression string or pattern.\n*\n* @module @stdlib/utils-escape-regexp-string\n*\n* @example\n* var rescape = require( '@stdlib/utils-escape-regexp-string' );\n*\n* var str = rescape( '[A-Z]*' );\n* // returns '\\\\[A\\\\-Z\\\\]\\\\*'\n*/\n\n// MODULES //\n\nvar rescape = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = rescape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar RE = /./;\n\n\n// EXPORTS //\n\nmodule.exports = RE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a boolean primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean primitive\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns false\n*/\nfunction isBoolean( value ) {\n\treturn ( typeof value === 'boolean' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Boolean.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a boolean object\n*\n* @example\n* var bool = isBoolean( true );\n* // returns false\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Boolean ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Boolean]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a boolean.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a boolean\n*\n* @example\n* var bool = isBoolean( false );\n* // returns true\n*\n* @example\n* var bool = isBoolean( true );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* var bool = isBoolean( new Boolean( true ) );\n* // returns true\n*/\nfunction isBoolean( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a boolean.\n*\n* @module @stdlib/assert-is-boolean\n*\n* @example\n* var isBoolean = require( '@stdlib/assert-is-boolean' );\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*\n* @example\n* // Use interface to check for boolean primitives...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\n*\n* var bool = isBoolean( false );\n* // returns true\n*\n* bool = isBoolean( new Boolean( true ) );\n* // returns false\n*\n* @example\n* // Use interface to check for boolean objects...\n* var isBoolean = require( '@stdlib/assert-is-boolean' ).isObject;\n*\n* var bool = isBoolean( true );\n* // returns false\n*\n* bool = isBoolean( new Boolean( false ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isBoolean = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isBoolean, 'isPrimitive', isPrimitive );\nsetReadOnly( isBoolean, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isBoolean;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the global object using code generation.\n*\n* @private\n* @returns {Object} global object\n*/\nfunction getGlobal() {\n\treturn new Function( 'return this;' )(); // eslint-disable-line no-new-func\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar obj = ( typeof self === 'object' ) ? self : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar obj = ( typeof window === 'object' ) ? window : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar obj = ( typeof global === 'object' ) ? global : null;\n\n\n// EXPORTS //\n\nmodule.exports = obj;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar getThis = require( './codegen.js' );\nvar Self = require( './self.js' );\nvar Win = require( './window.js' );\nvar Global = require( './global.js' );\n\n\n// MAIN //\n\n/**\n* Returns the global object.\n*\n* ## Notes\n*\n* - Using code generation is the **most** reliable way to resolve the global object; however, doing so is likely to violate content security policies (CSPs) in, e.g., Chrome Apps and elsewhere.\n*\n* @param {boolean} [codegen=false] - boolean indicating whether to use code generation to resolve the global object\n* @throws {TypeError} must provide a boolean\n* @throws {Error} unable to resolve global object\n* @returns {Object} global object\n*\n* @example\n* var g = getGlobal();\n* // returns {...}\n*/\nfunction getGlobal( codegen ) {\n\tif ( arguments.length ) {\n\t\tif ( !isBoolean( codegen ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. Must provide a boolean primitive. Value: `'+codegen+'`.' );\n\t\t}\n\t\tif ( codegen ) {\n\t\t\treturn getThis();\n\t\t}\n\t\t// Fall through...\n\t}\n\t// Case: browsers and web workers\n\tif ( Self ) {\n\t\treturn Self;\n\t}\n\t// Case: browsers\n\tif ( Win ) {\n\t\treturn Win;\n\t}\n\t// Case: Node.js\n\tif ( Global ) {\n\t\treturn Global;\n\t}\n\t// Case: unknown\n\tthrow new Error( 'unexpected error. Unable to resolve global object.' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 getGlobal = require( '@stdlib/utils-global' );\n\n\n// MAIN //\n\nvar root = getGlobal();\nvar nodeList = root.document && root.document.childNodes;\n\n\n// EXPORTS //\n\nmodule.exports = nodeList;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return the global object.\n*\n* @module @stdlib/utils-global\n*\n* @example\n* var getGlobal = require( '@stdlib/utils-global' );\n*\n* var g = getGlobal();\n* // returns {...}\n*/\n\n// MODULES //\n\nvar getGlobal = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getGlobal;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar typedarray = Int8Array; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = typedarray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 RE = require( './fixtures/re.js' );\nvar nodeList = require( './fixtures/nodelist.js' );\nvar typedarray = require( './fixtures/typedarray.js' );\n\n\n// MAIN //\n\n/**\n* Checks whether a polyfill is needed when using the `typeof` operator.\n*\n* @private\n* @returns {boolean} boolean indicating whether a polyfill is needed\n*/\nfunction check() {\n\tif (\n\t\t// Chrome 1-12 returns 'function' for regular expression instances (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof):\n\t\ttypeof RE === 'function' ||\n\n\t\t// Safari 8 returns 'object' for typed array and weak map constructors (underscore #1929):\n\t\ttypeof typedarray === 'object' ||\n\n\t\t// PhantomJS 1.9 returns 'function' for `NodeList` instances (underscore #2236):\n\t\ttypeof nodeList === 'function'\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Returns a regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\nfunction reFunctionName() {\n\treturn /^\\s*function\\s*([^(]*)/i;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Regular expression to capture everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* @module @stdlib/regexp-function-name\n*\n* @example\n* var reFunctionName = require( '@stdlib/regexp-function-name' );\n* var RE_FUNCTION_NAME = reFunctionName();\n*\n* function fname( fcn ) {\n* return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];\n* }\n*\n* var fn = fname( Math.sqrt );\n* // returns 'sqrt'\n*\n* fn = fname( Int8Array );\n* // returns 'Int8Array'\n*\n* fn = fname( Object.prototype.toString );\n* // returns 'toString'\n*\n* fn = fname( function(){} );\n* // returns ''\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reFunctionName = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reFunctionName, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reFunctionName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 reFunctionName = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Captures everything that is not a space immediately after the `function` keyword and before the first left parenthesis.\n*\n* Regular expression: `/^\\s*function\\s*([^(]*)/i`\n*\n* - `/^\\s*`\n* - Match zero or more spaces at beginning\n*\n* - `function`\n* - Match the word `function`\n*\n* - `\\s*`\n* - Match zero or more spaces after the word `function`\n*\n* - `()`\n* - Capture\n*\n* - `[^(]*`\n* - Match anything except a left parenthesis `(` zero or more times\n*\n* - `/i`\n* - ignore case\n*\n* @constant\n* @type {RegExp}\n* @default /^\\s*function\\s*([^(]*)/i\n*/\nvar RE_FUNCTION_NAME = reFunctionName();\n\n\n// EXPORTS //\n\nmodule.exports = RE_FUNCTION_NAME;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar f;\n\n\n// FUNCTIONS //\n\n/**\n* Tests if a value is an array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an array\n*\n* @example\n* var bool = isArray( [] );\n* // returns true\n*\n* @example\n* var bool = isArray( {} );\n* // returns false\n*/\nfunction isArray( value ) {\n\treturn ( nativeClass( value ) === '[object Array]' );\n}\n\n\n// MAIN //\n\nif ( Array.isArray ) {\n\tf = Array.isArray;\n} else {\n\tf = isArray;\n}\n\n\n// EXPORTS //\n\nmodule.exports = f;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an array.\n*\n* @module @stdlib/assert-is-array\n*\n* @example\n* var isArray = require( '@stdlib/assert-is-array' );\n*\n* var bool = isArray( [] );\n* // returns true\n*\n* bool = isArray( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isArray = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Returns a function which tests if every element in an array passes a test condition.\n*\n* @param {Function} predicate - function to apply\n* @throws {TypeError} must provide a function\n* @returns {Function} an array function\n*\n* @example\n* var isOdd = require( '@stdlib/assert-is-odd' );\n*\n* var arr1 = [ 1, 3, 5, 7 ];\n* var arr2 = [ 3, 5, 8 ];\n*\n* var validate = arrayfcn( isOdd );\n*\n* var bool = validate( arr1 );\n* // returns true\n*\n* bool = validate( arr2 );\n* // returns false\n*/\nfunction arrayfcn( predicate ) {\n\tif ( typeof predicate !== 'function' ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a function. Value: `' + predicate + '`.' );\n\t}\n\treturn every;\n\n\t/**\n\t* Tests if every element in an array passes a test condition.\n\t*\n\t* @private\n\t* @param {*} value - value to test\n\t* @returns {boolean} boolean indicating whether a value is an array for which all elements pass a test condition\n\t*/\n\tfunction every( value ) {\n\t\tvar len;\n\t\tvar i;\n\t\tif ( !isArray( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tlen = value.length;\n\t\tif ( len === 0 ) {\n\t\t\treturn false;\n\t\t}\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( predicate( value[ i ] ) === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = arrayfcn;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is object-like.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is object-like\n*\n* @example\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( [] );\n* // returns true\n*\n* @example\n* var bool = isObjectLike( null );\n* // returns false\n*/\nfunction isObjectLike( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is object-like.\n*\n* @module @stdlib/assert-is-object-like\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' );\n*\n* var bool = isObjectLike( {} );\n* // returns true\n*\n* bool = isObjectLike( [] );\n* // returns true\n*\n* bool = isObjectLike( null );\n* // returns false\n*\n* @example\n* var isObjectLike = require( '@stdlib/assert-is-object-like' ).isObjectLikeArray;\n*\n* var bool = isObjectLike( [ {}, [] ] );\n* // returns true\n*\n* bool = isObjectLike( [ {}, '3.0' ] );\n* // returns false\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar arrayfun = require( '@stdlib/assert-tools-array-function' );\nvar isObjectLike = require( './main.js' );\n\n\n// MAIN //\n\nsetReadOnly( isObjectLike, 'isObjectLikeArray', arrayfun( isObjectLike ) );\n\n\n// EXPORTS //\n\nmodule.exports = isObjectLike;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isObjectLike = require( '@stdlib/assert-is-object-like' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Buffer instance.\n*\n* @param {*} value - value to validate\n* @returns {boolean} boolean indicating if a value is a Buffer instance\n*\n* @example\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( new Buffer( [1,2,3,4] ) );\n* // returns true\n*\n* @example\n* var v = isBuffer( {} );\n* // returns false\n*\n* @example\n* var v = isBuffer( [] );\n* // returns false\n*/\nfunction isBuffer( value ) {\n\treturn (\n\t\tisObjectLike( value ) &&\n\t\t(\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvalue._isBuffer || // for envs missing Object.prototype.constructor (e.g., Safari 5-7)\n\t\t\t(\n\t\t\t\tvalue.constructor &&\n\n\t\t\t\t// WARNING: `typeof` is not a foolproof check, as certain envs consider RegExp and NodeList instances to be functions\n\t\t\t\ttypeof value.constructor.isBuffer === 'function' &&\n\t\t\t\tvalue.constructor.isBuffer( value )\n\t\t\t)\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a Buffer instance.\n*\n* @module @stdlib/assert-is-buffer\n*\n* @example\n* var isBuffer = require( '@stdlib/assert-is-buffer' );\n*\n* var v = isBuffer( new Buffer( 'beep' ) );\n* // returns true\n*\n* v = isBuffer( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isBuffer = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\nvar RE = require( '@stdlib/regexp-function-name' ).REGEXP;\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\n\n\n// MAIN //\n\n/**\n* Determines the name of a value's constructor.\n*\n* @param {*} v - input value\n* @returns {string} name of a value's constructor\n*\n* @example\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* @example\n* var v = constructorName( 5 );\n* // returns 'Number'\n*\n* @example\n* var v = constructorName( null );\n* // returns 'Null'\n*\n* @example\n* var v = constructorName( undefined );\n* // returns 'Undefined'\n*\n* @example\n* var v = constructorName( function noop() {} );\n* // returns 'Function'\n*/\nfunction constructorName( v ) {\n\tvar match;\n\tvar name;\n\tvar ctor;\n\tname = nativeClass( v ).slice( 8, -1 );\n\tif ( (name === 'Object' || name === 'Error') && v.constructor ) {\n\t\tctor = v.constructor;\n\t\tif ( typeof ctor.name === 'string' ) {\n\t\t\treturn ctor.name;\n\t\t}\n\t\tmatch = RE.exec( ctor.toString() );\n\t\tif ( match ) {\n\t\t\treturn match[ 1 ];\n\t\t}\n\t}\n\tif ( isBuffer( v ) ) {\n\t\treturn 'Buffer';\n\t}\n\treturn name;\n}\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// NOTES //\n\n/*\n* Built-in `typeof` operator behavior:\n*\n* ```text\n* typeof null => 'object'\n* typeof undefined => 'undefined'\n* typeof 'a' => 'string'\n* typeof 5 => 'number'\n* typeof NaN => 'number'\n* typeof true => 'boolean'\n* typeof false => 'boolean'\n* typeof {} => 'object'\n* typeof [] => 'object'\n* typeof function foo(){} => 'function'\n* typeof function* foo(){} => 'object'\n* typeof Symbol() => 'symbol'\n* ```\n*\n*/\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\tvar type;\n\n\t// Address `typeof null` => `object` (see http://wiki.ecmascript.org/doku.php?id=harmony:typeof_null):\n\tif ( v === null ) {\n\t\treturn 'null';\n\t}\n\ttype = typeof v;\n\n\t// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.\n\tif ( type === 'object' ) {\n\t\treturn ctorName( v ).toLowerCase();\n\t}\n\treturn type;\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine the name of a value's constructor.\n*\n* @module @stdlib/utils-constructor-name\n*\n* @example\n* var constructorName = require( '@stdlib/utils-constructor-name' );\n*\n* var v = constructorName( 'a' );\n* // returns 'String'\n*\n* v = constructorName( {} );\n* // returns 'Object'\n*\n* v = constructorName( true );\n* // returns 'Boolean'\n*/\n\n// MODULES //\n\nvar constructorName = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = constructorName;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 ctorName = require( '@stdlib/utils-constructor-name' );\n\n\n// MAIN //\n\n/**\n* Determines a value's type.\n*\n* @param {*} v - input value\n* @returns {string} string indicating the value's type\n*/\nfunction typeOf( v ) {\n\treturn ctorName( v ).toLowerCase();\n}\n\n\n// EXPORTS //\n\nmodule.exports = typeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine a value's type.\n*\n* @module @stdlib/utils-type-of\n*\n* @example\n* var typeOf = require( '@stdlib/utils-type-of' );\n*\n* var str = typeOf( 'a' );\n* // returns 'string'\n*\n* str = typeOf( 5 );\n* // returns 'number'\n*/\n\n// MODULES //\n\nvar usePolyfill = require( './check.js' );\nvar typeOf = require( './typeof.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main = ( usePolyfill() ) ? polyfill : typeOf;\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 typeOf = require( '@stdlib/utils-type-of' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a function.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a function\n*\n* @example\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\nfunction isFunction( value ) {\n\t// Note: cannot use `typeof` directly, as various browser engines incorrectly return `'function'` when operating on non-function objects, such as regular expressions and NodeLists.\n\treturn ( typeOf( value ) === 'function' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a function.\n*\n* @module @stdlib/assert-is-function\n*\n* @example\n* var isFunction = require( '@stdlib/assert-is-function' );\n*\n* function beep() {\n* return 'beep';\n* }\n*\n* var bool = isFunction( beep );\n* // returns true\n*/\n\n// MODULES //\n\nvar isFunction = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isFunction;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 exec = require( './exec.js' );\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nvar exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = exec;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar test = require( './try2exec.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 rescape = require( '@stdlib/utils-escape-regexp-string' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isRegExp = require( '@stdlib/assert-is-regexp' );\n\n\n// MAIN //\n\n/**\n* Replace search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string primitive\n* @throws {TypeError} second argument argument must be a string primitive or regular expression\n* @throws {TypeError} third argument must be a string primitive or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* var capitalize = require( '@stdlib/string-capitalize' );\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer);\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be a string primitive. Value: `' + str + '`.' );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = rescape( search );\n\t\tsearch = new RegExp( search, 'g' );\n\t}\n\telse if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( 'invalid argument. Second argument must be a string primitive or regular expression. Value: `' + search + '`.' );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( 'invalid argument. Third argument must be a string primitive or replacement function. Value: `' + newval + '`.' );\n\t}\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Replace search occurrences with a replacement string.\n*\n* @module @stdlib/string-replace\n*\n* @example\n* var replace = require( '@stdlib/string-replace' );\n*\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* str = 'Hello World';\n* out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*/\n\n// MODULES //\n\nvar replace = require( './replace.js' );\n\n\n// EXPORTS //\n\nmodule.exports = replace;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Tests if a value is a number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( typeof value === 'number' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Constructor which returns a `Number` object.\n*\n* @module @stdlib/number-ctor\n*\n* @example\n* var Number = require( '@stdlib/number-ctor' );\n*\n* var v = new Number( 10.0 );\n* // returns \n*/\n\n// MODULES //\n\nvar Number = require( './number.js' );\n\n\n// EXPORTS //\n\nmodule.exports = Number;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// EXPORTS //\n\nmodule.exports = Number; // eslint-disable-line stdlib/require-globals\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 toString = require( './tostring.js' ); // eslint-disable-line stdlib/no-redeclare\n\n\n// MAIN //\n\n/**\n* Attempts to serialize a value to a string.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value can be serialized\n*/\nfunction test( value ) {\n\ttry {\n\t\ttoString.call( value );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = test;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n// eslint-disable-next-line stdlib/no-redeclare\nvar toString = Number.prototype.toString; // non-generic\n\n\n// EXPORTS //\n\nmodule.exports = toString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasToStringTag = require( '@stdlib/assert-has-tostringtag-support' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\nvar Number = require( '@stdlib/number-ctor' );\nvar test = require( './try2serialize.js' );\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\nfunction isNumber( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof Number ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( FLG ) {\n\t\t\treturn test( value );\n\t\t}\n\t\treturn ( nativeClass( value ) === '[object Number]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a number\n*\n* @example\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* @example\n* var bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* @example\n* var bool = isNumber( NaN );\n* // returns true\n*\n* @example\n* var bool = isNumber( null );\n* // returns false\n*/\nfunction isNumber( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a number.\n*\n* @module @stdlib/assert-is-number\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' );\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( null );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\n*\n* var bool = isNumber( 3.14 );\n* // returns true\n*\n* bool = isNumber( NaN );\n* // returns true\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns false\n*\n* @example\n* var isNumber = require( '@stdlib/assert-is-number' ).isObject;\n*\n* var bool = isNumber( 3.14 );\n* // returns false\n*\n* bool = isNumber( new Number( 3.14 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNumber = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNumber, 'isPrimitive', isPrimitive );\nsetReadOnly( isNumber, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNumber;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point positive infinity.\n*\n* @module @stdlib/constants-float64-pinf\n* @type {number}\n*\n* @example\n* var FLOAT64_PINF = require( '@stdlib/constants-float64-pinf' );\n* // returns Infinity\n*/\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.POSITIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_PINF = Number.POSITIVE_INFINITY; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Double-precision floating-point negative infinity.\n*\n* @module @stdlib/constants-float64-ninf\n* @type {number}\n*\n* @example\n* var FLOAT64_NINF = require( '@stdlib/constants-float64-ninf' );\n* // returns -Infinity\n*/\n\n// MODULES //\n\nvar Number = require( '@stdlib/number-ctor' );\n\n\n// MAIN //\n\n/**\n* Double-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Double-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default Number.NEGATIVE_INFINITY\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_NINF = Number.NEGATIVE_INFINITY;\n\n\n// EXPORTS //\n\nmodule.exports = FLOAT64_NINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 floor = require( '@stdlib/math-base-special-floor' );\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an integer.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an integer\n*\n* @example\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( 3.14 );\n* // returns false\n*/\nfunction isInteger( x ) {\n\treturn (floor(x) === x);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: implementation (?)\n\n/**\n* Rounds a double-precision floating-point number toward negative infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = floor( -4.2 );\n* // returns -5.0\n*\n* @example\n* var v = floor( 9.99999 );\n* // returns 9.0\n*\n* @example\n* var v = floor( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = floor( NaN );\n* // returns NaN\n*/\nvar floor = Math.floor; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nmodule.exports = floor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a finite double-precision floating-point number is an integer.\n*\n* @module @stdlib/math-base-assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/math-base-assert-is-integer' );\n*\n* var bool = isInteger( 1.0 );\n* // returns true\n*\n* bool = isInteger( 3.14 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isInteger = require( './is_integer.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 PINF = require( '@stdlib/constants-float64-pinf' );\nvar NINF = require( '@stdlib/constants-float64-ninf' );\nvar isInt = require( '@stdlib/math-base-assert-is-integer' );\n\n\n// MAIN //\n\n/**\n* Tests if a number primitive is an integer value.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a number primitive is an integer value\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tvalue < PINF &&\n\t\tvalue > NINF &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having an integer value\n*\n* @example\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isInt = require( './integer.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having an integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having an integer value\n*\n* @example\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isInteger( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisInt( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an integer\n*\n* @example\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isInteger( -3.14 );\n* // returns false\n*\n* @example\n* var bool = isInteger( null );\n* // returns false\n*/\nfunction isInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an integer.\n*\n* @module @stdlib/assert-is-integer\n*\n* @example\n* var isInteger = require( '@stdlib/assert-is-integer' );\n*\n* var bool = isInteger( 5.0 );\n* // returns true\n*\n* bool = isInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isInteger( -3.14 );\n* // returns false\n*\n* bool = isInteger( null );\n* // returns false\n*\n* @example\n* // Use interface to check for integer primitives...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n*\n* var bool = isInteger( -3.0 );\n* // returns true\n*\n* bool = isInteger( new Number( -3.0 ) );\n* // returns false\n*\n* @example\n* // Use interface to check for integer objects...\n* var isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n*\n* var bool = isInteger( 3.0 );\n* // returns false\n*\n* bool = isInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInteger = require( '@stdlib/assert-is-integer' ).isObject;\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a nonnegative integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a nonnegative integer value\n*\n* @example\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() >= 0\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a nonnegative integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a nonnegative integer\n*\n* @example\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isNonNegativeInteger( null );\n* // returns false\n*/\nfunction isNonNegativeInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a nonnegative integer.\n*\n* @module @stdlib/assert-is-nonnegative-integer\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' );\n*\n* var bool = isNonNegativeInteger( 5.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isNonNegativeInteger( -5.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( 3.14 );\n* // returns false\n*\n* bool = isNonNegativeInteger( null );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns true\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isObject;\n*\n* var bool = isNonNegativeInteger( 3.0 );\n* // returns false\n*\n* bool = isNonNegativeInteger( new Number( 3.0 ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNonNegativeInteger = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isNonNegativeInteger, 'isPrimitive', isPrimitive );\nsetReadOnly( isNonNegativeInteger, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isNonNegativeInteger;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\nvar getProto = require( './proto.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFunction = require( '@stdlib/assert-is-function' );\nvar builtin = require( './native.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getProto;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 getProto = require( './detect.js' );\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getPrototypeOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return the prototype of a provided object.\n*\n* @module @stdlib/utils-get-prototype-of\n*\n* @example\n* var getPrototype = require( '@stdlib/utils-get-prototype-of' );\n*\n* var proto = getPrototype( {} );\n* // returns {}\n*/\n\n// MODULES //\n\nvar getPrototype = require( './get_prototype_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = getPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an `Error` object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `Error` object\n*\n* @example\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* @example\n* var bool = isError( {} );\n* // returns false\n*/\nfunction isError( value ) {\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for `Error` objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tif ( value instanceof Error ) {\n\t\treturn true;\n\t}\n\t// Walk the prototype tree until we find an object having the desired native class...\n\twhile ( value ) {\n\t\tif ( nativeClass( value ) === '[object Error]' ) {\n\t\t\treturn true;\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `Error` object.\n*\n* @module @stdlib/assert-is-error\n*\n* @example\n* var isError = require( '@stdlib/assert-is-error' );\n*\n* var bool = isError( new Error( 'beep' ) );\n* // returns true\n*\n* bool = isError( {} );\n* // returns false\n*/\n\n// MODULES //\n\nvar isError = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isError;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Returns a regular expression to parse a regular expression string.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*/\nfunction reRegExp() {\n\treturn /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/; // eslint-disable-line no-useless-escape\n}\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return a regular expression to parse a regular expression string.\n*\n* @module @stdlib/regexp-regexp\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var bool = RE_REGEXP.test( '/^beep$/' );\n* // returns true\n*\n* bool = RE_REGEXP.test( '' );\n* // returns false\n*\n* @example\n* var reRegExp = require( '@stdlib/regexp-regexp' );\n*\n* var RE_REGEXP = reRegExp();\n*\n* var parts = RE_REGEXP.exec( '/^.*$/ig' );\n* // returns [ '/^.*$/ig', '^.*$', 'ig', 'index': 0, 'input': '/^.*$/ig' ]\n*/\n\n// MAIN //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar reRegExp = require( './main.js' );\nvar REGEXP = require( './regexp.js' );\n\n\n// MAIN //\n\nsetReadOnly( reRegExp, 'REGEXP', REGEXP );\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n\n\n// EXPORTS //\n\nmodule.exports = reRegExp;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 reRegExp = require( './main.js' );\n\n\n// MAIN //\n\n/**\n* Matches parts of a regular expression string.\n*\n* Regular expression: `/^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/`\n*\n* - `/^\\/`\n* - match a string that begins with a `/`\n*\n* - `()`\n* - capture\n*\n* - `(?:)+`\n* - capture, but do not remember, a group of characters which occur one or more times\n*\n* - `\\\\\\/`\n* - match the literal `\\/`\n*\n* - `|`\n* - OR\n*\n* - `[^\\/]`\n* - anything which is not the literal `\\/`\n*\n* - `\\/`\n* - match the literal `/`\n*\n* - `([imgy]*)`\n* - capture any characters matching `imgy` occurring zero or more times\n*\n* - `$/`\n* - string end\n*\n*\n* @constant\n* @type {RegExp}\n* @default /^\\/((?:\\\\\\/|[^\\/])+)\\/([imgy]*)$/\n*/\nvar RE_REGEXP = reRegExp();\n\n\n// EXPORTS //\n\nmodule.exports = RE_REGEXP;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar reRegExp = require( '@stdlib/regexp-regexp' );\n\n\n// MAIN //\n\n/**\n* Parses a regular expression string and returns a new regular expression.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} must provide a regular expression string\n* @returns {(RegExp|null)} regular expression or null\n*\n* @example\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\nfunction reFromString( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a regular expression string. Value: `' + str + '`.' );\n\t}\n\t// Capture the regular expression pattern and any flags:\n\tstr = reRegExp().exec( str );\n\n\t// Create a new regular expression:\n\treturn ( str ) ? new RegExp( str[1], str[2] ) : null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Create a regular expression from a regular expression string.\n*\n* @module @stdlib/utils-regexp-from-string\n*\n* @example\n* var reFromString = require( '@stdlib/utils-regexp-from-string' );\n*\n* var re = reFromString( '/beep/' );\n* // returns /beep/\n*/\n\n// MODULES //\n\nvar reFromString = require( './from_string.js' );\n\n\n// EXPORTS //\n\nmodule.exports = reFromString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a double-precision floating-point numeric value is `NaN`.\n*\n* @module @stdlib/math-base-assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/math-base-assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 7.0 );\n* // returns false\n*/\n\n// MODULES //\n\nvar isnan = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isNumber = require( '@stdlib/assert-is-number' ).isObject;\nvar isNan = require( '@stdlib/math-base-assert-is-nan' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is `NaN`.\n*\n* @module @stdlib/assert-is-nan\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' );\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* var isnan = require( '@stdlib/assert-is-nan' ).isObject;\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isnan = require( './main.js' );\nvar isPrimitive = require( './primitive.js' );\nvar isObject = require( './object.js' );\n\n\n// MAIN //\n\nsetReadOnly( isnan, 'isPrimitive', isPrimitive );\nsetReadOnly( isnan, 'isObject', isObject );\n\n\n// EXPORTS //\n\nmodule.exports = isnan;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is a collection.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a collection\n*\n* @example\n* var bool = isCollection( [] );\n* // returns true\n*\n* @example\n* var bool = isCollection( {} );\n* // returns false\n*/\nfunction isCollection( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isCollection;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isnan = require( '@stdlib/assert-is-nan' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} `fromIndex` must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array-like object. Value: `' + arr + '`.' );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `fromIndex` must be an integer. Value: `' + fromIndex + '`.' );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Maximum length of a typed array.\n*\n* @module @stdlib/constants-array-max-typed-array-length\n*\n* @example\n* var MAX_TYPED_ARRAY_LENGTH = require( '@stdlib/constants-array-max-typed-array-length' );\n* // returns 9007199254740991\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a typed array.\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n*/\nvar MAX_TYPED_ARRAY_LENGTH = 9007199254740991;\n\n\n// EXPORTS //\n\nmodule.exports = MAX_TYPED_ARRAY_LENGTH;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return the first index at which a given element can be found.\n*\n* @module @stdlib/utils-index-of\n*\n* @example\n* var indexOf = require( '@stdlib/utils-index-of' );\n*\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* arr = [ 4, 3, 2, 1 ];\n* idx = indexOf( arr, 5 );\n* // returns -1\n*\n* // Using a `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* // `fromIndex` which exceeds `array` length:\n* arr = [ 1, 2, 3, 4, 2, 5 ];\n* idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* // Negative `fromIndex`:\n* arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* // Negative `fromIndex` exceeding input `array` length:\n* arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* // Array-like objects:\n* var str = 'bebop';\n* idx = indexOf( str, 'o' );\n* // returns 3\n*/\n\n// MODULES //\n\nvar indexOf = require( './index_of.js' );\n\n\n// EXPORTS //\n\nmodule.exports = indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.keys()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\treturn Object.keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 keys = require( './builtin.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Tests the built-in `Object.keys()` implementation when provided `arguments`.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected number of keys\n*/\nfunction test() {\n\treturn ( keys( arguments ) || '' ).length !== 2;\n}\n\n\n// MAIN //\n\n/**\n* Tests whether the built-in `Object.keys()` implementation supports providing `arguments` as an input value.\n*\n* ## Notes\n*\n* - Safari 5.0 does **not** support `arguments` as an input value.\n*\n* @private\n* @returns {boolean} boolean indicating whether a built-in implementation supports `arguments`\n*/\nfunction check() {\n\treturn test( 1, 2 );\n}\n\n\n// EXPORTS //\n\nmodule.exports = check;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar bool = ( typeof Object.keys !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn ( nativeClass( value ) === '[object Arguments]' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArguments = require( './main.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment returns the expected internal class of the `arguments` object.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment behaves as expected\n*\n* @example\n* var bool = detect();\n* // returns \n*/\nfunction detect() {\n\treturn isArguments( arguments );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isEnum = require( './native.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Detects whether an environment has a bug where String indices are not detected as \"enumerable\" properties. Observed in Node v0.10.\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment has the bug\n*/\nfunction detect() {\n\treturn !isEnum.call( 'beep', '0' );\n}\n\n\n// MAIN //\n\nbool = detect();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @private\n* @name isEnumerableProperty\n* @type {Function}\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nvar isEnumerableProperty = Object.prototype.propertyIsEnumerable;\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isString = require( '@stdlib/assert-is-string' );\nvar isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isEnum = require( './native.js' );\nvar hasStringEnumBug = require( './has_string_enumerability_bug.js' );\n\n\n// MAIN //\n\n/**\n* Tests if an object's own property is enumerable.\n*\n* @param {*} value - value to test\n* @param {*} property - property to test\n* @returns {boolean} boolean indicating if an object property is enumerable\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* @example\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\nfunction isEnumerableProperty( value, property ) {\n\tvar bool;\n\tif (\n\t\tvalue === void 0 ||\n\t\tvalue === null\n\t) {\n\t\treturn false;\n\t}\n\tbool = isEnum.call( value, property );\n\tif ( !bool && hasStringEnumBug && isString( value ) ) {\n\t\t// Note: we only check for indices, as properties attached to a `String` object are properly detected as enumerable above.\n\t\tproperty = +property;\n\t\treturn (\n\t\t\t!isnan( property ) &&\n\t\t\tisInteger( property ) &&\n\t\t\tproperty >= 0 &&\n\t\t\tproperty < value.length\n\t\t);\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test whether an object's own property is enumerable.\n*\n* @module @stdlib/assert-is-enumerable-property\n*\n* @example\n* var isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n*\n* var beep = {\n* 'boop': true\n* };\n*\n* var bool = isEnumerableProperty( beep, 'boop' );\n* // returns true\n*\n* bool = isEnumerableProperty( beep, 'hasOwnProperty' );\n* // returns false\n*/\n\n// MODULES //\n\nvar isEnumerableProperty = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isEnumerableProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isInteger = require( '@stdlib/math-base-assert-is-integer' );\nvar MAX_LENGTH = require( '@stdlib/constants-uint32-max' );\n\n\n// MAIN //\n\n/**\n* Tests whether a value is an `arguments` object.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is an `arguments` object\n*\n* @example\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* @example\n* var bool = isArguments( [] );\n* // returns false\n*/\nfunction isArguments( value ) {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!isArray( value ) &&\n\t\ttypeof value.length === 'number' &&\n\t\tisInteger( value.length ) &&\n\t\tvalue.length >= 0 &&\n\t\tvalue.length <= MAX_LENGTH &&\n\t\thasOwnProp( value, 'callee' ) &&\n\t\t!isEnumerableProperty( value, 'callee' )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is an `arguments` object.\n*\n* @module @stdlib/assert-is-arguments\n*\n* @example\n* var isArguments = require( '@stdlib/assert-is-arguments' );\n*\n* function foo() {\n* return arguments;\n* }\n*\n* var bool = isArguments( foo() );\n* // returns true\n*\n* bool = isArguments( [] );\n* // returns false\n*/\n\n// MODULES //\n\nvar hasArgumentsClass = require( './detect.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar isArguments;\nif ( hasArgumentsClass ) {\n\tisArguments = main;\n} else {\n\tisArguments = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = isArguments;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Maximum unsigned 32-bit integer.\n*\n* @module @stdlib/constants-uint32-max\n* @type {uinteger32}\n*\n* @example\n* var UINT32_MAX = require( '@stdlib/constants-uint32-max' );\n* // returns 4294967295\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111111111111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar UINT32_MAX = 4294967295;\n\n\n// EXPORTS //\n\nmodule.exports = UINT32_MAX;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArguments = require( '@stdlib/assert-is-arguments' );\nvar builtin = require( './builtin.js' );\n\n\n// VARIABLES //\n\nvar slice = Array.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tif ( isArguments( value ) ) {\n\t\treturn builtin( slice.call( value ) );\n\t}\n\treturn builtin( value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nmodule.exports = noop;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\nvar noop = require( '@stdlib/utils-noop' );\n\n\n// MAIN //\n\n// Note: certain environments treat an object's prototype as enumerable, which, as a matter of convention, it shouldn't be...\nvar bool = isEnumerableProperty( noop, 'prototype' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isEnumerableProperty = require( '@stdlib/assert-is-enumerable-property' );\n\n\n// VARIABLES //\n\nvar obj = {\n\t'toString': null\n};\n\n\n// MAIN //\n\n// Note: certain environments don't allow enumeration of overwritten properties which are considered non-enumerable...\nvar bool = !isEnumerableProperty( obj, 'toString' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Tests whether a value equals the prototype of its constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction isConstructorPrototype( value ) {\n\treturn ( value.constructor && value.constructor.prototype === value );\n}\n\n\n// EXPORTS //\n\nmodule.exports = isConstructorPrototype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar EXCLUDED_KEYS = require( './excluded_keys.json' );\nvar win = require( './window.js' );\n\n\n// VARIABLES //\n\nvar bool;\n\n\n// FUNCTIONS //\n\n/**\n* Determines whether an environment throws when comparing to the prototype of a value's constructor (e.g., [IE9][1]).\n*\n* [1]: https://stackoverflow.com/questions/7688070/why-is-comparing-the-constructor-property-of-two-windows-unreliable\n*\n* @private\n* @returns {boolean} boolean indicating whether an environment is buggy\n*/\nfunction check() {\n\tvar k;\n\tif ( typeOf( win ) === 'undefined' ) {\n\t\treturn false;\n\t}\n\tfor ( k in win ) { // eslint-disable-line guard-for-in\n\t\ttry {\n\t\t\tif (\n\t\t\t\tindexOf( EXCLUDED_KEYS, k ) === -1 &&\n\t\t\t\thasOwnProp( win, k ) &&\n\t\t\t\twin[ k ] !== null &&\n\t\t\t\ttypeOf( win[ k ] ) === 'object'\n\t\t\t) {\n\t\t\t\tisConstructorPrototype( win[ k ] );\n\t\t\t}\n\t\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// MAIN //\n\nbool = check();\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar w = ( typeof window === 'undefined' ) ? void 0 : window;\n\n\n// EXPORTS //\n\nmodule.exports = w;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar bool = ( typeof window !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasAutomationEqualityBug = require( './has_automation_equality_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype.js' );\nvar HAS_WINDOW = require( './has_window.js' );\n\n\n// MAIN //\n\n/**\n* Wraps the test for constructor prototype equality to accommodate buggy environments (e.g., environments which throw when testing equality).\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value equals the prototype of its constructor\n*/\nfunction wrapper( value ) {\n\tif ( HAS_WINDOW === false && !hasAutomationEqualityBug ) {\n\t\treturn isConstructorPrototype( value );\n\t}\n\ttry {\n\t\treturn isConstructorPrototype( value );\n\t} catch ( error ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = wrapper;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isObjectLike = require( '@stdlib/assert-is-object-like' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArguments = require( '@stdlib/assert-is-arguments' );\nvar HAS_ENUM_PROTO_BUG = require( './has_enumerable_prototype_bug.js' );\nvar HAS_NON_ENUM_PROPS_BUG = require( './has_non_enumerable_properties_bug.js' );\nvar isConstructorPrototype = require( './is_constructor_prototype_wrapper.js' );\nvar NON_ENUMERABLE = require( './non_enumerable.json' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction keys( value ) {\n\tvar skipConstructor;\n\tvar skipPrototype;\n\tvar isFcn;\n\tvar out;\n\tvar k;\n\tvar p;\n\tvar i;\n\n\tout = [];\n\tif ( isArguments( value ) ) {\n\t\t// Account for environments which treat `arguments` differently...\n\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\tout.push( i.toString() );\n\t\t}\n\t\t// Note: yes, we are precluding the `arguments` array-like object from having other enumerable properties; however, this should (1) be very rare and (2) not be encouraged (e.g., doing something like `arguments.a = 'b'`; in certain engines directly manipulating the `arguments` value results in automatic de-optimization).\n\t\treturn out;\n\t}\n\tif ( typeof value === 'string' ) {\n\t\t// Account for environments which do not treat string character indices as \"own\" properties...\n\t\tif ( value.length > 0 && !hasOwnProp( value, '0' ) ) {\n\t\t\tfor ( i = 0; i < value.length; i++ ) {\n\t\t\t\tout.push( i.toString() );\n\t\t\t}\n\t\t}\n\t} else {\n\t\tisFcn = ( typeof value === 'function' );\n\t\tif ( isFcn === false && !isObjectLike( value ) ) {\n\t\t\treturn out;\n\t\t}\n\t\tskipPrototype = ( HAS_ENUM_PROTO_BUG && isFcn );\n\t}\n\tfor ( k in value ) {\n\t\tif ( !( skipPrototype && k === 'prototype' ) && hasOwnProp( value, k ) ) {\n\t\t\tout.push( String( k ) );\n\t\t}\n\t}\n\tif ( HAS_NON_ENUM_PROPS_BUG ) {\n\t\tskipConstructor = isConstructorPrototype( value );\n\t\tfor ( i = 0; i < NON_ENUMERABLE.length; i++ ) {\n\t\t\tp = NON_ENUMERABLE[ i ];\n\t\t\tif ( !( skipConstructor && p === 'constructor' ) && hasOwnProp( value, p ) ) {\n\t\t\t\tout.push( String( p ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasArgumentsBug = require( './has_arguments_bug.js' );\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar wrapper = require( './builtin_wrapper.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable property names.\n*\n* @name keys\n* @type {Function}\n* @param {*} value - input object\n* @returns {Array} a list of own enumerable property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nvar keys;\nif ( HAS_BUILTIN ) {\n\tif ( hasArgumentsBug() ) {\n\t\tkeys = wrapper;\n\t} else {\n\t\tkeys = builtin;\n\t}\n} else {\n\tkeys = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return an array of an object's own enumerable property names.\n*\n* @module @stdlib/utils-keys\n*\n* @example\n* var keys = require( '@stdlib/utils-keys' );\n*\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var k = keys( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\n\n// MODULES //\n\nvar keys = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = keys;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar bool = ( typeof Object.getOwnPropertyNames !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyNames = Object.getOwnPropertyNames;\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn propertyNames( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 keys = require( '@stdlib/utils-keys' );\n\n\n// MAIN //\n\n/**\n* Returns an array of an object's own enumerable and non-enumerable property names.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyNames()`, this function returns an empty array if provided `undefined` or `null`, rather than throwing an error.\n* - In environments lacking support for `Object.getOwnPropertyNames()`, property descriptors are unavailable, and thus all properties can be safely assumed to be enumerable. Hence, we can defer to calling `Object.keys`, which retrieves all own enumerable property names.\n*\n* @private\n* @param {*} value - input object\n* @returns {Array} a list of own property names\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var keys = getOwnPropertyNames( obj );\n* // e.g., returns [ 'beep', 'foo' ]\n*/\nfunction getOwnPropertyNames( value ) {\n\treturn keys( Object( value ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyNames;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return an array of an object's own enumerable and non-enumerable property names.\n*\n* @module @stdlib/utils-property-names\n*\n* @example\n* var getOwnPropertyNames = require( '@stdlib/utils-property-names' );\n*\n* var keys = getOwnPropertyNames({\n* 'foo': 'bar',\n* 'beep': 'boop'\n* });\n* // e.g., returns [ 'foo', 'beep' ]\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar bool = ( typeof Object.getOwnPropertyDescriptor !== 'undefined' );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// VARIABLES //\n\nvar propertyDescriptor = Object.getOwnPropertyDescriptor;\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tvar desc;\n\tif ( value === null || value === void 0 ) {\n\t\treturn null;\n\t}\n\tdesc = propertyDescriptor( value, property );\n\treturn ( desc === void 0 ) ? null : desc;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\n\n\n// MAIN //\n\n/**\n* Returns a property descriptor for an object's own property.\n*\n* ## Notes\n*\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if provided `undefined` or `null`, rather than throwing an error.\n* - In contrast to the built-in `Object.getOwnPropertyDescriptor()`, this function returns `null` if an object does not have a provided property, rather than `undefined`.\n* - In environments lacking `Object.getOwnPropertyDescriptor()` support, property descriptors do not exist. In non-supporting environment, if an object has a provided property, this function returns a descriptor object equivalent to that returned in a supporting environment; otherwise, the function returns `null`.\n*\n* @private\n* @param {*} value - input object\n* @param {(string|symbol)} property - property\n* @returns {(Object|null)} property descriptor or null\n*\n* @example\n* var obj = {\n* 'beep': 'boop',\n* 'foo': 3.14\n* };\n*\n* var desc = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':3.14}\n*/\nfunction getOwnPropertyDescriptor( value, property ) {\n\tif ( hasOwnProp( value, property ) ) {\n\t\treturn {\n\t\t\t'configurable': true,\n\t\t\t'enumerable': true,\n\t\t\t'writable': true,\n\t\t\t'value': value[ property ]\n\t\t};\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = getOwnPropertyDescriptor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Return a property descriptor for an object's own property.\n*\n* @module @stdlib/utils-property-descriptor\n*\n* @example\n* var getOwnPropertyDescriptor = require( '@stdlib/utils-property-descriptor' );\n*\n* var obj = {\n* 'foo': 'bar',\n* 'beep': 'boop'\n* };\n*\n* var keys = getOwnPropertyDescriptor( obj, 'foo' );\n* // returns {'configurable':true,'enumerable':true,'writable':true,'value':'bar'}\n*/\n\n// MODULES //\n\nvar HAS_BUILTIN = require( './has_builtin.js' );\nvar builtin = require( './builtin.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar main;\nif ( HAS_BUILTIN ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Buffer === 'function' ) ? Buffer : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isBuffer = require( '@stdlib/assert-is-buffer' );\nvar GlobalBuffer = require( './buffer.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Buffer` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Buffer` support\n*\n* @example\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\nfunction hasNodeBufferSupport() {\n\tvar bool;\n\tvar b;\n\n\tif ( typeof GlobalBuffer !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tif ( typeof GlobalBuffer.from === 'function' ) {\n\t\t\tb = GlobalBuffer.from( [ 1, 2, 3, 4 ] );\n\t\t} else {\n\t\t\tb = new GlobalBuffer( [ 1, 2, 3, 4 ] ); // Note: this is deprecated behavior starting in Node v6 (see https://nodejs.org/api/buffer.html#buffer_new_buffer_array)\n\t\t}\n\t\tbool = (\n\t\t\tisBuffer( b ) &&\n\t\t\tb[ 0 ] === 1 &&\n\t\t\tb[ 1 ] === 2 &&\n\t\t\tb[ 2 ] === 3 &&\n\t\t\tb[ 3 ] === 4\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasNodeBufferSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Buffer` support.\n*\n* @module @stdlib/assert-has-node-buffer-support\n*\n* @example\n* var hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\n*\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasNodeBufferSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write (browser) polyfill\n\n// MAIN //\n\n/**\n* Buffer constructor.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Buffer constructor.\n*\n* @module @stdlib/buffer-ctor\n*\n* @example\n* var ctor = require( '@stdlib/buffer-ctor' );\n*\n* var b = new ctor( [ 1, 2, 3, 4 ] );\n* // returns \n*/\n\n// MODULES //\n\nvar hasNodeBufferSupport = require( '@stdlib/assert-has-node-buffer-support' );\nvar main = require( './buffer.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasNodeBufferSupport() ) {\n\tctor = main;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = require( 'buffer' ).Buffer; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFunction = require( '@stdlib/assert-is-function' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from );\n\n\n// EXPORTS //\n\nmodule.exports = bool;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn Buffer.from( buffer );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isBuffer = require( '@stdlib/assert-is-buffer' );\nvar Buffer = require( '@stdlib/buffer-ctor' );\n\n\n// MAIN //\n\n/**\n* Copies buffer data to a new `Buffer` instance.\n*\n* @param {Buffer} buffer - buffer from which to copy\n* @throws {TypeError} must provide a `Buffer` instance\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = fromBuffer( b1 );\n* // returns \n*/\nfunction fromBuffer( buffer ) {\n\tif ( !isBuffer( buffer ) ) {\n\t\tthrow new TypeError( 'invalid argument. Must provide a Buffer. Value: `' + buffer + '`' );\n\t}\n\treturn new Buffer( buffer ); // eslint-disable-line no-buffer-constructor\n}\n\n\n// EXPORTS //\n\nmodule.exports = fromBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy buffer data to a new `Buffer` instance.\n*\n* @module @stdlib/buffer-from-buffer\n*\n* @example\n* var fromArray = require( '@stdlib/buffer-from-array' );\n* var copyBuffer = require( '@stdlib/buffer-from-buffer' );\n*\n* var b1 = fromArray( [ 1, 2, 3, 4 ] );\n* // returns \n*\n* var b2 = copyBuffer( b1 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFrom = require( './has_from.js' );\nvar main = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar copyBuffer;\nif ( hasFrom ) {\n\tcopyBuffer = main;\n} else {\n\tcopyBuffer = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = copyBuffer;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Int8Array === 'function' ) ? Int8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInt8Array = require( '@stdlib/assert-is-int8array' );\nvar INT8_MAX = require( '@stdlib/constants-int8-max' );\nvar INT8_MIN = require( '@stdlib/constants-int8-min' );\nvar GlobalInt8Array = require( './int8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants-int8-min\n* @type {integer32}\n*\n* @example\n* var INT8_MIN = require( '@stdlib/constants-int8-min' );\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT8_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int8\n*\n* @example\n* var ctor = require( '@stdlib/array-int8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\nvar builtin = require( './int8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Int8Array === 'function' ) ? Int8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int8Array` support.\n*\n* @module @stdlib/assert-has-int8array-support\n*\n* @example\n* var hasInt8ArraySupport = require( '@stdlib/assert-has-int8array-support' );\n*\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8Array = ( typeof Uint8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8Array\n*\n* @example\n* var bool = isUint8Array( new Uint8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8Array( [] );\n* // returns false\n*/\nfunction isUint8Array( value ) {\n\treturn (\n\t\t( hasUint8Array && value instanceof Uint8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Uint8Array === 'function' ) ? Uint8Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isUint8Array = require( '@stdlib/assert-is-uint8array' );\nvar UINT8_MAX = require( '@stdlib/constants-uint8-max' );\nvar GlobalUint8Array = require( './uint8array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8Array` support\n*\n* @example\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\nfunction hasUint8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT8_MAX+1, UINT8_MAX+2 ];\n\t\tarr = new GlobalUint8Array( arr );\n\t\tbool = (\n\t\t\tisUint8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT8_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint8\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\nvar builtin = require( './uint8array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Uint8Array === 'function' ) ? Uint8Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8Array` support.\n*\n* @module @stdlib/assert-has-uint8array-support\n*\n* @example\n* var hasUint8ArraySupport = require( '@stdlib/assert-has-uint8array-support' );\n*\n* var bool = hasUint8ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint8ClampedArray;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isUint8ClampedArray = require( '@stdlib/assert-is-uint8clampedarray' );\nvar GlobalUint8ClampedArray = require( './uint8clampedarray.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 8-bit unsigned integers in the platform byte order clamped to 0-255.\n*\n* @module @stdlib/array-uint8c\n*\n* @example\n* var ctor = require( '@stdlib/array-uint8c' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' ); // eslint-disable-line id-length\nvar builtin = require( './uint8clampedarray.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint8ClampedArray` support.\n*\n* @module @stdlib/assert-has-uint8clampedarray-support\n*\n* @example\n* var hasUint8ClampedArraySupport = require( '@stdlib/assert-has-uint8clampedarray-support' );\n*\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint8ClampedArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint8ClampedArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Int16Array === 'function' ) ? Int16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInt16Array = require( '@stdlib/assert-is-int16array' );\nvar INT16_MAX = require( '@stdlib/constants-int16-max' );\nvar INT16_MIN = require( '@stdlib/constants-int16-min' );\nvar GlobalInt16Array = require( './int16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants-int16-min\n* @type {integer32}\n*\n* @example\n* var INT16_MIN = require( '@stdlib/constants-int16-min' );\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT16_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int16\n*\n* @example\n* var ctor = require( '@stdlib/array-int16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\nvar builtin = require( './int16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Int16Array === 'function' ) ? Int16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int16Array` support.\n*\n* @module @stdlib/assert-has-int16array-support\n*\n* @example\n* var hasInt16ArraySupport = require( '@stdlib/assert-has-int16array-support' );\n*\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Uint16Array === 'function' ) ? Uint16Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isUint16Array = require( '@stdlib/assert-is-uint16array' );\nvar UINT16_MAX = require( '@stdlib/constants-uint16-max' );\nvar GlobalUint16Array = require( './uint16array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 16-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint16\n*\n* @example\n* var ctor = require( '@stdlib/array-uint16' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\nvar builtin = require( './uint16array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Uint16Array === 'function' ) ? Uint16Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint16Array` support.\n*\n* @module @stdlib/assert-has-uint16array-support\n*\n* @example\n* var hasUint16ArraySupport = require( '@stdlib/assert-has-uint16array-support' );\n*\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint16ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint16ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isInt32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Int32Array === 'function' ) ? Int32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isInt32Array = require( '@stdlib/assert-is-int32array' );\nvar INT32_MAX = require( '@stdlib/constants-int32-max' );\nvar INT32_MIN = require( '@stdlib/constants-int32-min' );\nvar GlobalInt32Array = require( './int32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants-int32-min\n* @type {integer32}\n*\n* @example\n* var INT32_MIN = require( '@stdlib/constants-int32-min' );\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nmodule.exports = INT32_MIN;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array-int32\n*\n* @example\n* var ctor = require( '@stdlib/array-int32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\nvar builtin = require( './int32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Int32Array === 'function' ) ? Int32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Int32Array` support.\n*\n* @module @stdlib/assert-has-int32array-support\n*\n* @example\n* var hasInt32ArraySupport = require( '@stdlib/assert-has-int32array-support' );\n*\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasInt32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasInt32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isUint32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Uint32Array === 'function' ) ? Uint32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isUint32Array = require( '@stdlib/assert-is-uint32array' );\nvar UINT32_MAX = require( '@stdlib/constants-uint32-max' );\nvar GlobalUint32Array = require( './uint32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_MAX-2 && // truncation and wrap around\n\t\t\tarr[ 3 ] === 0 && // wrap around\n\t\t\tarr[ 4 ] === 1 // wrap around\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of 32-bit unsigned integers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array-uint32\n*\n* @example\n* var ctor = require( '@stdlib/array-uint32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\nvar builtin = require( './uint32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Uint32Array === 'function' ) ? Uint32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Uint32Array` support.\n*\n* @module @stdlib/assert-has-uint32array-support\n*\n* @example\n* var hasUint32ArraySupport = require( '@stdlib/assert-has-uint32array-support' );\n*\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasUint32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasUint32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat32Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Float32Array === 'function' ) ? Float32Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFloat32Array = require( '@stdlib/assert-is-float32array' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar GlobalFloat32Array = require( './float32array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of single-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float32\n*\n* @example\n* var ctor = require( '@stdlib/array-float32' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\nvar builtin = require( './float32array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Float32Array === 'function' ) ? Float32Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float32Array` support.\n*\n* @module @stdlib/assert-has-float32array-support\n*\n* @example\n* var hasFloat32ArraySupport = require( '@stdlib/assert-has-float32array-support' );\n*\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat32ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat32ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isFloat64Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar main = ( typeof Float64Array === 'function' ) ? Float64Array : null; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isFloat64Array = require( '@stdlib/assert-is-float64array' );\nvar GlobalFloat64Array = require( './float64array.js' );\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\n\t\t);\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\tbool = false;\n\t}\n\treturn bool;\n}\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers in the platform byte order.\n*\n* @throws {Error} not implemented\n*/\nfunction polyfill() {\n\tthrow new Error( 'not implemented' );\n}\n\n\n// EXPORTS //\n\nmodule.exports = polyfill;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array-float64\n*\n* @example\n* var ctor = require( '@stdlib/array-float64' );\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\nvar builtin = require( './float64array.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\n\tctor = builtin;\n} else {\n\tctor = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar ctor = ( typeof Float64Array === 'function' ) ? Float64Array : void 0; // eslint-disable-line stdlib/require-globals\n\n\n// EXPORTS //\n\nmodule.exports = ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test for native `Float64Array` support.\n*\n* @module @stdlib/assert-has-float64array-support\n*\n* @example\n* var hasFloat64ArraySupport = require( '@stdlib/assert-has-float64array-support' );\n*\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\n\n// MODULES //\n\nvar hasFloat64ArraySupport = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = hasFloat64ArraySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 Int8Array = require( '@stdlib/array-int8' );\nvar Uint8Array = require( '@stdlib/array-uint8' );\nvar Uint8ClampedArray = require( '@stdlib/array-uint8c' );\nvar Int16Array = require( '@stdlib/array-int16' );\nvar Uint16Array = require( '@stdlib/array-uint16' );\nvar Int32Array = require( '@stdlib/array-int32' );\nvar Uint32Array = require( '@stdlib/array-uint32' );\nvar Float32Array = require( '@stdlib/array-float32' );\nvar Float64Array = require( '@stdlib/array-float64' );\n\n\n// VARIABLES //\n\nvar hash;\n\n\n// FUNCTIONS //\n\n/**\n* Copies an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - array to copy\n* @returns {Int8Array} new array\n*/\nfunction int8array( arr ) {\n\treturn new Int8Array( arr );\n}\n\n/**\n* Copies a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - array to copy\n* @returns {Uint8Array} new array\n*/\nfunction uint8array( arr ) {\n\treturn new Uint8Array( arr );\n}\n\n/**\n* Copies a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - array to copy\n* @returns {Uint8ClampedArray} new array\n*/\nfunction uint8clampedarray( arr ) {\n\treturn new Uint8ClampedArray( arr );\n}\n\n/**\n* Copies an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - array to copy\n* @returns {Int16Array} new array\n*/\nfunction int16array( arr ) {\n\treturn new Int16Array( arr );\n}\n\n/**\n* Copies a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - array to copy\n* @returns {Uint16Array} new array\n*/\nfunction uint16array( arr ) {\n\treturn new Uint16Array( arr );\n}\n\n/**\n* Copies an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - array to copy\n* @returns {Int32Array} new array\n*/\nfunction int32array( arr ) {\n\treturn new Int32Array( arr );\n}\n\n/**\n* Copies a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - array to copy\n* @returns {Uint32Array} new array\n*/\nfunction uint32array( arr ) {\n\treturn new Uint32Array( arr );\n}\n\n/**\n* Copies a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - array to copy\n* @returns {Float32Array} new array\n*/\nfunction float32array( arr ) {\n\treturn new Float32Array( arr );\n}\n\n/**\n* Copies a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - array to copy\n* @returns {Float64Array} new array\n*/\nfunction float64array( arr ) {\n\treturn new Float64Array( arr );\n}\n\n/**\n* Returns a hash of functions for copying typed arrays.\n*\n* @private\n* @returns {Object} function hash\n*/\nfunction typedarrays() {\n\tvar out = {\n\t\t'int8array': int8array,\n\t\t'uint8array': uint8array,\n\t\t'uint8clampedarray': uint8clampedarray,\n\t\t'int16array': int16array,\n\t\t'uint16array': uint16array,\n\t\t'int32array': int32array,\n\t\t'uint32array': uint32array,\n\t\t'float32array': float32array,\n\t\t'float64array': float64array\n\t};\n\treturn out;\n}\n\n\n// MAIN //\n\nhash = typedarrays();\n\n\n// EXPORTS //\n\nmodule.exports = hash;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isArray = require( '@stdlib/assert-is-array' );\nvar isBuffer = require( '@stdlib/assert-is-buffer' );\nvar isError = require( '@stdlib/assert-is-error' );\nvar typeOf = require( '@stdlib/utils-type-of' );\nvar regexp = require( '@stdlib/utils-regexp-from-string' );\nvar indexOf = require( '@stdlib/utils-index-of' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar propertyNames = require( '@stdlib/utils-property-names' );\nvar propertyDescriptor = require( '@stdlib/utils-property-descriptor' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar defineProperty = require( '@stdlib/utils-define-property' );\nvar copyBuffer = require( '@stdlib/buffer-from-buffer' );\nvar typedArrays = require( './typed_arrays.js' );\n\n\n// FUNCTIONS //\n\n/**\n* Clones a class instance.\n*\n* ## Notes\n*\n* - This should **only** be used for simple cases. Any instances with privileged access to variables (e.g., within closures) cannot be cloned. This approach should be considered **fragile**.\n* - The function is greedy, disregarding the notion of a `level`. Instead, the function deep copies all properties, as we assume the concept of `level` applies only to the class instance reference but not to its internal state. This prevents, in theory, two instances from sharing state.\n*\n*\n* @private\n* @param {Object} val - class instance\n* @returns {Object} new instance\n*/\nfunction cloneInstance( val ) {\n\tvar cache;\n\tvar names;\n\tvar name;\n\tvar refs;\n\tvar desc;\n\tvar tmp;\n\tvar ref;\n\tvar i;\n\n\tcache = [];\n\trefs = [];\n\n\tref = Object.create( getPrototypeOf( val ) );\n\tcache.push( val );\n\trefs.push( ref );\n\n\tnames = propertyNames( val );\n\tfor ( i = 0; i < names.length; i++ ) {\n\t\tname = names[ i ];\n\t\tdesc = propertyDescriptor( val, name );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( val[name] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( val[name], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( ref, name, desc );\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( ref );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( ref );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( ref );\n\t}\n\treturn ref;\n}\n\n/**\n* Copies an error object.\n*\n* @private\n* @param {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error - error to copy\n* @returns {(Error|TypeError|SyntaxError|URIError|ReferenceError|RangeError|EvalError)} error copy\n*\n* @example\n* var err1 = new TypeError( 'beep' );\n*\n* var err2 = copyError( err1 );\n* // returns \n*/\nfunction copyError( error ) {\n\tvar cache = [];\n\tvar refs = [];\n\tvar keys;\n\tvar desc;\n\tvar tmp;\n\tvar key;\n\tvar err;\n\tvar i;\n\n\t// Create a new error...\n\terr = new error.constructor( error.message );\n\n\tcache.push( error );\n\trefs.push( err );\n\n\t// If a `stack` property is present, copy it over...\n\tif ( error.stack ) {\n\t\terr.stack = error.stack;\n\t}\n\t// Node.js specific (system errors)...\n\tif ( error.code ) {\n\t\terr.code = error.code;\n\t}\n\tif ( error.errno ) {\n\t\terr.errno = error.errno;\n\t}\n\tif ( error.syscall ) {\n\t\terr.syscall = error.syscall;\n\t}\n\t// Any enumerable properties...\n\tkeys = objectKeys( error );\n\tfor ( i = 0; i < keys.length; i++ ) {\n\t\tkey = keys[ i ];\n\t\tdesc = propertyDescriptor( error, key );\n\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\ttmp = ( isArray( error[ key ] ) ) ? [] : {};\n\t\t\tdesc.value = deepCopy( error[ key ], tmp, cache, refs, -1 );\n\t\t}\n\t\tdefineProperty( err, key, desc );\n\t}\n\treturn err;\n}\n\n\n// MAIN //\n\n/**\n* Recursively performs a deep copy of an input object.\n*\n* @private\n* @param {*} val - value to copy\n* @param {(Array|Object)} copy - copy\n* @param {Array} cache - an array of visited objects\n* @param {Array} refs - an array of object references\n* @param {NonNegativeInteger} level - copy depth\n* @returns {*} deep copy\n*/\nfunction deepCopy( val, copy, cache, refs, level ) {\n\tvar parent;\n\tvar keys;\n\tvar name;\n\tvar desc;\n\tvar ctor;\n\tvar key;\n\tvar ref;\n\tvar x;\n\tvar i;\n\tvar j;\n\n\tlevel -= 1;\n\n\t// Primitives and functions...\n\tif (\n\t\ttypeof val !== 'object' ||\n\t\tval === null\n\t) {\n\t\treturn val;\n\t}\n\tif ( isBuffer( val ) ) {\n\t\treturn copyBuffer( val );\n\t}\n\tif ( isError( val ) ) {\n\t\treturn copyError( val );\n\t}\n\t// Objects...\n\tname = typeOf( val );\n\n\tif ( name === 'date' ) {\n\t\treturn new Date( +val );\n\t}\n\tif ( name === 'regexp' ) {\n\t\treturn regexp( val.toString() );\n\t}\n\tif ( name === 'set' ) {\n\t\treturn new Set( val );\n\t}\n\tif ( name === 'map' ) {\n\t\treturn new Map( val );\n\t}\n\tif (\n\t\tname === 'string' ||\n\t\tname === 'boolean' ||\n\t\tname === 'number'\n\t) {\n\t\t// If provided an `Object`, return an equivalent primitive!\n\t\treturn val.valueOf();\n\t}\n\tctor = typedArrays[ name ];\n\tif ( ctor ) {\n\t\treturn ctor( val );\n\t}\n\t// Class instances...\n\tif (\n\t\tname !== 'array' &&\n\t\tname !== 'object'\n\t) {\n\t\t// Cloning requires ES5 or higher...\n\t\tif ( typeof Object.freeze === 'function' ) {\n\t\t\treturn cloneInstance( val );\n\t\t}\n\t\treturn {};\n\t}\n\t// Arrays and plain objects...\n\tkeys = objectKeys( val );\n\tif ( level > 0 ) {\n\t\tparent = name;\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tx = val[ key ];\n\n\t\t\t// Primitive, Buffer, special class instance...\n\t\t\tname = typeOf( x );\n\t\t\tif (\n\t\t\t\ttypeof x !== 'object' ||\n\t\t\t\tx === null ||\n\t\t\t\t(\n\t\t\t\t\tname !== 'array' &&\n\t\t\t\t\tname !== 'object'\n\t\t\t\t) ||\n\t\t\t\tisBuffer( x )\n\t\t\t) {\n\t\t\t\tif ( parent === 'object' ) {\n\t\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\t\tdesc.value = deepCopy( x );\n\t\t\t\t\t}\n\t\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t\t} else {\n\t\t\t\t\tcopy[ key ] = deepCopy( x );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Circular reference...\n\t\t\ti = indexOf( cache, x );\n\t\t\tif ( i !== -1 ) {\n\t\t\t\tcopy[ key ] = refs[ i ];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Plain array or object...\n\t\t\tref = ( isArray( x ) ) ? new Array( x.length ) : {};\n\t\t\tcache.push( x );\n\t\t\trefs.push( ref );\n\t\t\tif ( parent === 'array' ) {\n\t\t\t\tcopy[ key ] = deepCopy( x, ref, cache, refs, level );\n\t\t\t} else {\n\t\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\t\tif ( hasOwnProp( desc, 'value' ) ) {\n\t\t\t\t\tdesc.value = deepCopy( x, ref, cache, refs, level );\n\t\t\t\t}\n\t\t\t\tdefineProperty( copy, key, desc );\n\t\t\t}\n\t\t}\n\t} else if ( name === 'array' ) {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tcopy[ key ] = val[ key ];\n\t\t}\n\t} else {\n\t\tfor ( j = 0; j < keys.length; j++ ) {\n\t\t\tkey = keys[ j ];\n\t\t\tdesc = propertyDescriptor( val, key );\n\t\t\tdefineProperty( copy, key, desc );\n\t\t}\n\t}\n\tif ( !Object.isExtensible( val ) ) {\n\t\tObject.preventExtensions( copy );\n\t}\n\tif ( Object.isSealed( val ) ) {\n\t\tObject.seal( copy );\n\t}\n\tif ( Object.isFrozen( val ) ) {\n\t\tObject.freeze( copy );\n\t}\n\treturn copy;\n}\n\n\n// EXPORTS //\n\nmodule.exports = deepCopy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArray = require( '@stdlib/assert-is-array' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar deepCopy = require( './deep_copy.js' );\n\n\n// MAIN //\n\n/**\n* Copies or deep clones a value to an arbitrary depth.\n*\n* @param {*} value - value to copy\n* @param {NonNegativeInteger} [level=+infinity] - copy depth\n* @throws {TypeError} `level` must be a nonnegative integer\n* @returns {*} value copy\n*\n* @example\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ { 'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\nfunction copy( value, level ) {\n\tvar out;\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isNonNegativeInteger( level ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. `level` must be a nonnegative integer. Value: `' + level + '`.' );\n\t\t}\n\t\tif ( level === 0 ) {\n\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tlevel = PINF;\n\t}\n\tout = ( isArray( value ) ) ? new Array( value.length ) : {};\n\treturn deepCopy( value, out, [value], [out], level );\n}\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Copy or deep clone a value to an arbitrary depth.\n*\n* @module @stdlib/utils-copy\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var out = copy( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var copy = require( '@stdlib/utils-copy' );\n*\n* var value = [\n* {\n* 'a': 1,\n* 'b': true,\n* 'c': [ 1, 2, 3 ]\n* }\n* ];\n* var out = copy( value );\n* // returns [ {'a': 1, 'b': true, 'c': [ 1, 2, 3 ] } ]\n*\n* var bool = ( value[0].c === out[0].c );\n* // returns false\n*/\n\n// MODULES //\n\nvar copy = require( './copy.js' );\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isArray = require( '@stdlib/assert-is-array' );\n\n\n// MAIN //\n\n/**\n* Tests if a value is an object; e.g., `{}`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an object\n*\n* @example\n* var bool = isObject( {} );\n* // returns true\n*\n* @example\n* var bool = isObject( null );\n* // returns false\n*/\nfunction isObject( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t!isArray( value )\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar getPrototypeOf = require( '@stdlib/utils-get-prototype-of' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar nativeClass = require( '@stdlib/utils-native-class' );\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 isObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {(Error|null)} error object or null\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );\n\t}\n\tif ( hasOwnProp( options, 'url' ) ) {\n\t\topts.url = options.url;\n\t\tif ( !isString( opts.url ) ) {\n\t\t\treturn new TypeError( 'invalid option. `url` option must be a string primitive. Option: `' + opts.url + '`.' );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'message' ) ) {\n\t\topts.message = options.message;\n\t\tif ( !isString( opts.message ) ) {\n\t\t\treturn new TypeError( 'invalid option. `message` option must be a string primitive. Option: `' + opts.message + '`.' );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Test if a value is a plain object.\n*\n* @module @stdlib/assert-is-plain-object\n*\n* @example\n* var isPlainObject = require( '@stdlib/assert-is-plain-object' );\n*\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* bool = isPlainObject( null );\n* // returns false\n*/\n\n// MODULES //\n\nvar isPlainObject = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = isPlainObject;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 replace = require( '@stdlib/string-replace' );\nvar copy = require( '@stdlib/utils-copy' );\nvar validate = require( './validate.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Returns a function which formats an error message for production.\n*\n* @param {Options} options - function options\n* @param {string} [options.url] - website URL for full error message\n* @param {string} [options.message] - error message template with `{{url}}` and `{{code}}` placeholders that will be replaced\n* @returns {Function} error formatting function\n*\n* @example\n* var opts = {\n* 'url': 'https://stdlib.io/error-decoder.html'\n* };\n*\n* var fcn = factory( opts );\n* // returns \n*/\nfunction factory( options ) {\n\tvar opts;\n\tvar err;\n\topts = copy( defaults );\n\terr = validate( opts, options );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\treturn formatProdErrorMessage;\n\n\t/**\n\t* Formats an error message for production.\n\t*\n\t* @private\n\t* @param {string} code - error code\n\t* @param {*} ...args - error message arguments\n\t* @returns {string} formatted error message\n\t*/\n\tfunction formatProdErrorMessage() {\n\t\tvar code = arguments[ 0 ];\n\t\tvar url = opts.url + '?code='+code;\n\t\tvar msg;\n\t\tvar i;\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\turl += '&arg[]=' + encodeURIComponent( arguments[ i ] );\n\t\t}\n\t\tmsg = replace( opts.message, '{{url}}', url );\n\t\tmsg = replace( msg, '{{code}}', code );\n\t\treturn msg;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Format an error message for production.\n*\n* @module @stdlib/error-tools-fmtprodmsg\n*\n* @example\n* var formatProdErrorMessage = require( '@stdlib/error-tools-fmtprodmsg' );\n*\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar formatProdErrorMessage = require( './main.js' );\nvar factory = require( './factory.js' );\n\n\n// MAIN //\n\nsetReadOnly( formatProdErrorMessage, 'factory', factory );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 factory = require( './factory.js' );\nvar defaults = require( './defaults.json' );\n\n\n// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @name formatProdErrorMessage\n* @type {Function}\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = formatProdErrorMessage( '3', 'wrong_type' );\n* // returns \n*/\nvar formatProdErrorMessage = factory( defaults );\n\n\n// EXPORTS //\n\nmodule.exports = formatProdErrorMessage;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nmodule.exports = strides2offset;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Determine the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @module @stdlib/ndarray-strides2offset\n*\n* @example\n* var strides2offset = require( '@stdlib/ndarray-base-strides2offset' );\n*\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\n\n// MODULES //\n\nvar strides2offset = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = strides2offset;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset' ;\n\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array' ;\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n"],"names":["defineProperty","Object","has_define_property_support","err","builtin","objectProtoype","prototype","toStr","toString","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","polyfill","obj","prop","descriptor","hasValue","hasGet","hasSet","call","TypeError","__proto__","value","Error","get","set","require$$1","require$$2","lib","require$$0","main","configurable","enumerable","writable","primitive","FLG","Symbol","hasSymbols","toStringTag","tostring","native_class","v","has","hasOwnProperty","property","toStrTag","hasOwnProp","isOwn","tag","out","valueOf","String","nativeClass","test","object","isPrimitive","isObject","setReadOnly","isString","require$$3","RE_CHARS","str","s","i","length","replace","substring","re","Boolean","isBoolean","codegen","Function","self_1","self","window_1","window","global","module","exports","getThis","Self","Win","Global","arguments","root","nodeList","document","childNodes","typedarray","Int8Array","RE","check_1","reFunctionName","Array","isArray","isObjectLike","predicate","len","arrayfun","_isBuffer","constructor","isBuffer","REGEXP","match","name","ctor","slice","exec","ctorName","typeOf","type","toLowerCase","RegExp","rescape","isFunction","isRegExp","search","newval","Number","isNumber","POSITIVE_INFINITY","NEGATIVE_INFINITY","floor","Math","x","PINF","NINF","isInt","integer","isInteger","isNonNegativeInteger","getProto","getPrototypeOf","proto","reRegExp","isNan","isnan","isCollection","arr","searchElement","fromIndex","keys","has_arguments_bug","has_builtin","isArguments","bool","detect_1","detect","native","propertyIsEnumerable","isEnum","hasStringEnumBug","isEnumerableProperty","builtin_wrapper","has_enumerable_prototype_bug","has_non_enumerable_properties_bug","is_constructor_prototype","w","indexOf","isConstructorPrototype","EXCLUDED_KEYS","win","k","check","hasAutomationEqualityBug","HAS_WINDOW","HAS_ENUM_PROTO_BUG","HAS_NON_ENUM_PROPS_BUG","require$$4","error","NON_ENUMERABLE","wrapper","skipConstructor","skipPrototype","isFcn","p","push","getOwnPropertyNames","propertyNames","getOwnPropertyDescriptor","propertyDescriptor","desc","Buffer","GlobalBuffer","b","from","buffer","hasInt8Array","isInt8Array","GlobalInt8Array","INT8_MAX","hasUint8Array","Uint8Array","isUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ClampedArray","Uint8ClampedArray","isUint8ClampedArray","GlobalUint8ClampedArray","hasInt16Array","Int16Array","isInt16Array","GlobalInt16Array","INT16_MAX","hasUint16Array","Uint16Array","isUint16Array","GlobalUint16Array","UINT16_MAX","hasInt32Array","Int32Array","isInt32Array","GlobalInt32Array","INT32_MAX","hasUint32Array","Uint32Array","isUint32Array","GlobalUint32Array","UINT32_MAX","hasFloat32Array","Float32Array","isFloat32Array","GlobalFloat32Array","hasFloat64Array","Float64Array","isFloat64Array","GlobalFloat64Array","NaN","require$$5","require$$6","require$$7","int8array","uint8array","uint8clampedarray","int16array","uint16array","int32array","uint32array","float32array","float64array","isError","regexp","objectKeys","require$$8","require$$9","require$$10","require$$11","copyBuffer","require$$12","typedArrays","deepCopy","val","copy","cache","refs","level","parent","key","ref","j","tmp","message","stack","code","errno","syscall","copyError","Date","Set","Map","freeze","names","create","isExtensible","preventExtensions","isSealed","seal","isFrozen","cloneInstance","objectPrototype","isPrototypeOf","ownProps","validate","opts","options","url","defaults","factory_1","msg","encodeURIComponent","formatProdErrorMessage","shape","strides","offset","ndims","transpose","sh","st","N","format","dtype","data","strides2offset","order"],"mappings":";;qWAsBA,ICAIA,EDA0C,mBAA1BC,OAAOD,eAAkCC,OAAOD,eAAiB,KC4BrF,IAAAE,EAbA,WAEC,IAEC,OADAF,EAAgB,GAAI,IAAK,KAClB,EACN,MAAQG,GACT,OAAO,ICiBTC,EALqBH,OAAOD,eC/BxBK,EAAiBJ,OAAOK,UACxBC,EAAQF,EAAeG,SACvBC,EAAeJ,EAAeK,iBAC9BC,EAAeN,EAAeO,iBAC9BC,EAAeR,EAAeS,iBAC9BC,EAAeV,EAAeW,iBAuFlC,IAAAC,EAnDA,SAAyBC,EAAKC,EAAMC,GACnC,IAAId,EACAe,EACAC,EACAC,EAEJ,GAAoB,iBAARL,GAA4B,OAARA,GAAsC,mBAAtBX,EAAMiB,KAAMN,GAC3D,MAAM,IAAIO,UAAW,+DAAiEP,EAAM,MAE7F,GAA2B,iBAAfE,GAA0C,OAAfA,GAAoD,mBAA7Bb,EAAMiB,KAAMJ,GACzE,MAAM,IAAIK,UAAW,oEAAsEL,EAAa,MAyBzG,IAvBAC,EAAa,UAAWD,KAGtBP,EAAaW,KAAMN,EAAKC,IACxBJ,EAAaS,KAAMN,EAAKC,IAGxBb,EAAYY,EAAIQ,UAChBR,EAAIQ,UAAYrB,SAGTa,EAAKC,GACZD,EAAKC,GAASC,EAAWO,MAGzBT,EAAIQ,UAAYpB,GAEhBY,EAAKC,GAASC,EAAWO,OAG3BL,EAAW,QAASF,EACpBG,EAAW,QAASH,EAEfC,IAAcC,GAAUC,GAC5B,MAAM,IAAIK,MAAO,wHASlB,OANKN,GAAUb,GACdA,EAAae,KAAMN,EAAKC,EAAMC,EAAWS,KAErCN,GAAUZ,GACdA,EAAaa,KAAMN,EAAKC,EAAMC,EAAWU,KAEnCZ,GCrEJd,EAAU2B,EACVd,EAAWe,EAefC,EAjB+BC,IASb9B,EAEAa,EC7BdjB,EAAiBkC,EAmCrB,IAAAC,EAZA,SAAmCjB,EAAKC,EAAMQ,GAC7C3B,EAAgBkB,EAAKC,EAAM,CAC1BiB,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZX,MAASA,KCJXM,EAL+BC,ECA/B,IAAAK,EAPA,SAAmBZ,GAClB,MAA0B,iBAAVA,GCMjB,ICdIa,EDIJ,WACC,MACmB,mBAAXC,QACoB,iBAApBA,OAAQ,OCPPC,GAqBV,ICTAT,EDEA,WACC,OAASO,GAAqC,iBAAvBC,OAAOE,aEf/BC,EALY3C,OAAOK,UAAUE,SCAzBD,EAAQ2B,EAiCZ,IAAAW,EAPA,SAAsBC,GACrB,OAAOvC,EAAMiB,KAAMsB,IC3BhBC,EAAM9C,OAAOK,UAAU0C,eAyC3B,ICjBAf,EDIA,SAAqBN,EAAOsB,GAC3B,OACCtB,SAKMoB,EAAIvB,KAAMG,EAAOsB,IEnCrBC,EAA+B,mBAAXT,OAA0BA,OAAOE,YAAc,GCAnEQ,EAAajB,EACbS,EDIaO,ECHb3C,EAAQyB,EAwDZ,ICpCI5B,EAAU2B,EACVd,EDKJ,SAAsB6B,GACrB,IAAIM,EACAC,EACAC,EAEJ,GAAKR,QACJ,OAAOvC,EAAMiB,KAAMsB,GAEpBO,EAAMP,EAAGH,GACTS,EAAQD,EAAYL,EAAGH,GAGvB,IACCG,EAAGH,QAAgB,EAClB,MAAQxC,GACT,OAAOI,EAAMiB,KAAMsB,GASpB,OAPAQ,EAAM/C,EAAMiB,KAAMsB,GAEbM,EACJN,EAAGH,GAAgBU,SAEZP,EAAGH,GAEJW,GCdRrB,EAjBqBC,IASNjB,EAEAb,EChCXmD,ECDUC,OAAOlD,UAAUiD,QDyB/B,IEvBIE,EAAc1B,EACd2B,EFUJ,SAAe/B,GACd,IAEC,OADA4B,EAAQ/B,KAAMG,IACP,EACN,MAAQxB,GACT,OAAO,IEVLqC,EAPiBN,IA0CrB,IAAAyB,EAhBA,SAAmBhC,GAClB,MAAsB,iBAAVA,IACNA,aAAiB6B,SAGjBhB,EACGkB,EAAM/B,GAEoB,oBAAzB8B,EAAa9B,MClCpBiC,EAAc1B,EACd2B,EAAW9B,EA0Bf,ICSA+B,EAAA5B,EACA6B,EDjBA,SAAmBpC,GAClB,OAASiC,EAAajC,IAAWkC,EAAUlC,ICkB5CkC,EAAAG,EAKAF,EAAAC,EAAA,cANA/B,GAOA8B,EAAAC,EAAA,WAAAF,GAKA,IAAA5B,EAAA8B,EClDIA,EAAW7B,EAAsC0B,YAKjDK,EAAW,yBAqDf,ICzCAhC,EDIA,SAAkBiC,GACjB,IACIC,EACAC,EAEJ,IAAML,EAAUG,GACf,MAAM,IAAIzC,UAAW,uEAAyEyC,EAAM,MAGrG,GAAkB,MAAbA,EAAK,GAGT,IAAME,EADAF,EAAIG,OACI,EAAGD,GAAK,GACH,MAAbF,EAAKE,GADcA,KAO1B,YAAW,IAANA,GAAgBA,GAAK,EAClBF,EAAII,QAASL,EAAU,SAM/BE,GAHAA,EAAID,EAAIK,UAAW,EAAGH,IAGhBE,QAASL,EAAU,QAGzBC,EAAMA,EAAK,GAAMC,EAAID,EAAIK,UAAWH,KE/CrCI,EALS,ICyBT,IAAAjC,EAPA,SAAoBZ,GACnB,MAA0B,kBAAVA,GCjBbnB,ECDWiE,QAAQnE,UAAUE,SDyBjC,IEvBIiD,EAAc1B,EACd2B,EFUJ,SAAe/B,GACd,IAEC,OADAnB,EAASgB,KAAMG,IACR,EACN,MAAQxB,GACT,OAAO,IEVLqC,EAPiBN,IA0CrB,IAAAyB,EAhBA,SAAoBhC,GACnB,MAAsB,iBAAVA,IACNA,aAAiB8C,UAGjBjC,EACGkB,EAAM/B,GAEoB,qBAAzB8B,EAAa9B,MClCpBiC,EAAc1B,EACd2B,GAAW9B,EAkCf,ICAA+B,GAAA5B,EACAwC,GDRA,SAAoB/C,GACnB,OAASiC,EAAajC,IAAWkC,GAAUlC,ICS5CkC,GAAAG,EAKAF,GAAAY,GAAA,cANA1C,GAOA8B,GAAAY,GAAA,WAAAb,IAKA,IAAA5B,GAAAyC,GCpCA,IAAAC,GAPA,WACC,OAAO,IAAIC,SAAU,eAAd,ICFRC,GAL4B,iBAATC,KAAsBA,KAAO,KCKhDC,GAL8B,iBAAXC,OAAwBA,OAAS,6GCAhD9D,GAA0B,iBAAX+D,GAAwBA,GAAS,KAKpDC,OAAOC,QAAUjE,OCLbwD,GAAYxC,GAAuC0B,YACnDwB,GAAUrD,GACVsD,GAAOrD,GACPsD,GAAMtB,GACNuB,sCAkDJ,IAAApD,GA7BA,SAAoBwC,GACnB,GAAKa,UAAUnB,OAAS,CACvB,IAAMK,GAAWC,GAChB,MAAM,IAAIlD,UAAW,+DAA+DkD,EAAQ,MAE7F,GAAKA,EACJ,OAAOS,KAKT,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,GAAKC,GACJ,OAAOA,GAGR,MAAM,IAAI3D,MAAO,uDC3Cd6D,GCOYvD,KDNZwD,GAAWD,GAAKE,UAAYF,GAAKE,SAASC,WER1CC,GAAaC,UCEbC,GAAK7D,EACLwD,GHUaA,GGTbG,GDCaA,GC6BjB,IAAAG,GAnBA,WACC,MAEe,mBAAPD,IAGe,iBAAfF,IAGa,mBAAbH,ICST,IAAAvD,GAPA,WACC,MAAO,2BCER8D,GAAAlE,GADAG,EAOA+D,GAAA,SCjCqB/D,MDsCrB,IAAAD,GAAAgE,GEtCIxC,GAAcvB,EAwClB,ICpBAD,GDWKiE,MAAMC,QACND,MAAMC,QARX,SAAkBxE,GACjB,MAAkC,mBAAzB8B,GAAa9B,IEzBnBwE,GAAUjE,GC0Bd,ICGIkE,GDbJ,SAAuBzE,GACtB,OACW,OAAVA,GACiB,iBAAVA,GCQSO,EAOLkE,GAAc,oBFR3B,SAAmBC,GAClB,GAA0B,mBAAdA,EACX,MAAM,IAAI5E,UAAW,sDAAwD4E,EAAY,MAE1F,OASA,SAAgB1E,GACf,IAAI2E,EACAlC,EACJ,IAAM+B,GAASxE,GACd,OAAO,EAGR,GAAa,KADb2E,EAAM3E,EAAM0C,QAEX,OAAO,EAER,IAAMD,EAAI,EAAGA,EAAIkC,EAAKlC,IACrB,IAAiC,IAA5BiC,EAAW1E,EAAOyC,IACtB,OAAO,EAGT,OAAO,GEpBuCmC,CAAUH,KAK1D,IAAAnE,GAAiBmE,GCvCbA,GAAelE,GA+CnB,IC3BAD,GDOA,SAAmBN,GAClB,OACCyE,GAAczE,KAGbA,EAAM6E,WAEL7E,EAAM8E,aAGgC,mBAA/B9E,EAAM8E,YAAYC,UACzB/E,EAAM8E,YAAYC,SAAU/E,KEtC5B8B,GAAcvB,EACd6D,GAAKhE,GAA0C4E,OAC/CD,GAAW1E,GAuDf,IAAAG,GAxBA,SAA0BW,GACzB,IAAI8D,EACAC,EACAC,EAEJ,IAAe,YADfD,EAAOpD,GAAaX,GAAIiE,MAAO,GAAI,KACC,UAATF,IAAqB/D,EAAE2D,YAAc,CAE/D,GAA0B,iBAD1BK,EAAOhE,EAAE2D,aACQI,KAChB,OAAOC,EAAKD,KAGb,GADAD,EAAQb,GAAGiB,KAAMF,EAAKtG,YAErB,OAAOoG,EAAO,GAGhB,OAAKF,GAAU5D,GACP,SAED+D,GCnDJI,GCkBkB/E,GDmCtB,IErDI+E,GDkBkB/E,GCAtB,ICFIgF,GHkBJ,SAAiBpE,GAChB,IAAIqE,EAGJ,OAAW,OAANrE,EACG,OAKM,YAHdqE,SAAcrE,GAINmE,GAAUnE,GAAIsE,cAEfD,GG9BJlG,GDNJ,SAAiB6B,GAChB,OAAOmE,GAAUnE,GAAIsE,eCetBnF,GAZkBC,KAOajB,GAAWiG,GCtBtCA,GAAShF,GA2Bb,ICNAD,GDFA,SAAqBN,GAEpB,MAA6B,aAApBuF,GAAQvF,IErBdqF,GCFOK,OAAO/G,UAAU0G,KD0B5B,IEvBIvD,GAAc1B,EACd2B,GFUJ,SAAe/B,GACd,IAEC,OADAqF,GAAKxF,KAAMG,IACJ,EACN,MAAQxB,GACT,OAAO,IEVLqC,GAPiBN,IA0CrB,IC1CIoF,GAAUpF,EACVqF,GAAaxF,GACbgC,GAAW/B,EAAsC4B,YACjD4D,GDuBJ,SAAmB7F,GAClB,MAAsB,iBAAVA,IACNA,aAAiB0F,SAGjB7E,GACGkB,GAAM/B,GAEoB,oBAAzB8B,GAAa9B,MC2BxB,ICvCAM,GDmBA,SAAkBiC,EAAKuD,EAAQC,GAC9B,IAAM3D,GAAUG,GACf,MAAM,IAAIzC,UAAW,wEAA0EyC,EAAM,MAEtG,GAAKH,GAAU0D,GACdA,EAASH,GAASG,GAClBA,EAAS,IAAIJ,OAAQI,EAAQ,UAEzB,IAAMD,GAAUC,GACpB,MAAM,IAAIhG,UAAW,+FAAiGgG,EAAS,MAEhI,IAAM1D,GAAU2D,KAAaH,GAAYG,GACxC,MAAM,IAAIjG,UAAW,gGAAkGiG,EAAS,MAEjI,OAAOxD,EAAII,QAASmD,EAAQC,IEhC7B,IAAAnF,GAPA,SAAmBZ,GAClB,MAA0B,iBAAVA,GCAjBM,GCjBiB0F,OCAbnH,GCAS0B,GAMS5B,UAAUE,SDkBhC,IEvBIiD,GAAc1B,EACd4F,GAAS3F,GACT0B,GFSJ,SAAe/B,GACd,IAEC,OADAnB,GAASgB,KAAMG,IACR,EACN,MAAQxB,GACT,OAAO,IETLqC,GARiBN,IA2CrB,IAAAyB,GAhBA,SAAmBhC,GAClB,MAAsB,iBAAVA,IACNA,aAAiBgG,KAGjBnF,GACGkB,GAAM/B,GAEoB,oBAAzB8B,GAAa9B,MCnCpBiC,GAAc1B,GACd2B,GAAW9B,GAkCf,ICOA+B,GAAA5B,EACA0F,GDfA,SAAmBjG,GAClB,OAASiC,GAAajC,IAAWkC,GAAUlC,ICgB5CkC,GAAAG,GAKAF,GAAA8D,GAAA,cANA5F,IAOA8B,GAAA8D,GAAA,WAAA/D,IAKA,IAAA5B,GAAA2F,GCvBA3F,GALmB0F,OAAOE,kBCS1B5F,GA1BaC,GAqBa4F,kBChCtBC,GCsBQC,KAAKD,MDIjB,IENA9F,GFDA,SAAoBgG,GACnB,OAAQF,GAAME,KAAOA,GGpBlBC,GAAOhG,GACPiG,GAAOpG,GACPqG,GAAQpG,GAuBZ,IAAAqG,GAXA,SAAoB1G,GACnB,OACCA,EAAQuG,IACRvG,EAAQwG,IACRC,GAAOzG,IClBLiG,GAAW1F,GAAsC0B,YACjDwE,GAAQrG,GA6BZ,IAAAQ,GAVA,SAAoBZ,GACnB,OACCiG,GAAUjG,IACVyG,GAAOzG,ICvBLiG,GAAW1F,GAAsC2B,SACjDuE,GAAQrG,GA6BZ,IAAA4B,GAVA,SAAoBhC,GACnB,OACCiG,GAAUjG,IACVyG,GAAOzG,EAAM4B,YCvBXK,GAAc1B,GACd2B,GAAW9B,GAkCf,ICMA+B,GAAA5B,EACAoG,GDdA,SAAoB3G,GACnB,OAASiC,GAAajC,IAAWkC,GAAUlC,ICe5CkC,GAAAG,GAKAF,GAAAwE,GAAA,cANAtG,IAOA8B,GAAAwE,GAAA,WAAAzE,IAKA,IAAA5B,GAAAqG,GCvDIA,GAAYpG,GAAuC0B,YA6BvD,IAAArB,GAVA,SAA+BZ,GAC9B,OACC2G,GAAW3G,IACXA,GAAS,GCtBP2G,GAAYpG,GAAuC2B,SA6BvD,IAAAF,GAVA,SAA+BhC,GAC9B,OACC2G,GAAW3G,IACXA,EAAM4B,WAAa,GCtBjBK,GAAc1B,GACd2B,GAAW9B,GAsCf,ICGA+B,GAAA5B,EACAqG,GDXA,SAA+B5G,GAC9B,OAASiC,GAAajC,IAAWkC,GAAUlC,ICY5CkC,GAAAG,GAKAF,GAAAyE,GAAA,cANAvG,IAOA8B,GAAAyE,GAAA,WAAA1E,IAKA,IAAA5B,GAAAsG,GCxDIC,GAAWvI,OAAOwI,eCatB,IAAAC,GARA,SAAmBxH,GAElB,OAAOA,EAAIQ,WCPR+B,GAAcvB,EACdsG,GAAWzG,GA+Bf,IAAAd,GAnBA,SAAyBC,GACxB,IAAIwH,EAAQF,GAAUtH,GACtB,OAAKwH,GAAmB,OAAVA,EACNA,EAEgC,sBAAnCjF,GAAavC,EAAIuF,aAEdvF,EAAIuF,YAAYnG,UAEnBY,aAAejB,OACZA,OAAOK,UAGR,MCzBJF,GHIaoI,GGHbvH,GAAWe,GCFXwG,GDAatG,GAQAjC,OAAOwI,gBACZrI,GAEAa,GCoBZ,ICdAgB,GDFA,SAAyBN,GACxB,OACCA,QAGO,MAGRA,EAAQ1B,OAAQ0B,GAET6G,GAAU7G,KEzBd8G,GAAiBvG,GACjBuB,GAAc1B,EAwClB,ICrBAE,GDAA,SAAkBN,GACjB,GAAsB,iBAAVA,GAAgC,OAAVA,EACjC,OAAO,EAGR,GAAKA,aAAiBC,MACrB,OAAO,EAGR,KAAQD,GAAQ,CACf,GAA8B,mBAAzB8B,GAAa9B,GACjB,OAAO,EAERA,EAAQ8G,GAAgB9G,GAEzB,OAAO,GEdR,IAAAQ,GAPA,WACC,MAAO,oCCWRwG,GAAA5G,GADAG,EAOAyG,GAAA,SChCezG,UCAX6B,GAAW7B,EAAsC0B,YACjD+E,GFyCJA,GEXA,ICdA1G,GDAA,SAAuBiC,GACtB,IAAMH,GAAUG,GACf,MAAM,IAAIzC,UAAW,uEAAyEyC,EAAM,MAMrG,OAHAA,EAAMyE,KAAW3B,KAAM9C,IAGN,IAAImD,OAAQnD,EAAI,GAAIA,EAAI,IAAO,MEJjD,IAAA/B,GAPA,SAAgB8F,GACf,OAASA,GAAMA,GCfZL,GAAW1F,GAAsC0B,YACjDgF,GCcQ1G,GDmBZ,IAAAK,GAVA,SAAgBZ,GACf,OACCiG,GAAUjG,IACViH,GAAOjH,IE3BLiG,GAAW1F,GAAsC2B,SACjD+E,GDcQ1G,GCeZ,IAAAyB,GAVA,SAAgBhC,GACf,OACCiG,GAAUjG,IACViH,GAAOjH,EAAM4B,YCvBXK,GAAc1B,GACd2B,GAAW9B,GAkCf,ICOA+B,GAAA5B,EACA2G,GDfA,SAAgBlH,GACf,OAASiC,GAAajC,IAAWkC,GAAUlC,ICgB5CkC,GAAAG,GAKAF,GAAA+E,GAAA,cANA7G,IAOA8B,GAAA+E,GAAA,WAAAhF,IAKA,IAAA5B,GAAA4G,GCxDIP,GAAYpG,GAkChB,IClCI2G,GAAQ3G,GACR4G,GDmBJ,SAAuBnH,GACtB,MACkB,iBAAVA,GACG,OAAVA,GACwB,iBAAjBA,EAAM0C,QACbiE,GAAW3G,EAAM0C,SACjB1C,EAAM0C,QAAU,GAChB1C,EAAM0C,QENqB,kBDnBzBN,GAAW/B,EAAsC4B,YACjD0E,GAAYtE,GAAuCJ,YA0GvD,IE3DA3B,GFWA,SAAkB8G,EAAKC,EAAeC,GACrC,IAAI3C,EACAlC,EACJ,IAAM0E,GAAcC,KAAUhF,GAAUgF,GACvC,MAAM,IAAItH,UAAW,0EAA4EsH,EAAM,MAGxG,GAAa,KADbzC,EAAMyC,EAAI1E,QAET,OAAQ,EAET,GAA0B,IAArBmB,UAAUnB,OAAe,CAC7B,IAAMiE,GAAWW,GAChB,MAAM,IAAIxH,UAAW,6DAA+DwH,EAAY,MAEjG,GAAKA,GAAa,EAAI,CACrB,GAAKA,GAAa3C,EACjB,OAAQ,EAETlC,EAAI6E,OAEJ7E,EAAIkC,EAAM2C,GACD,IACR7E,EAAI,QAINA,EAAI,EAGL,GAAKyE,GAAOG,IACX,KAAQ5E,EAAIkC,EAAKlC,IAChB,GAAKyE,GAAOE,EAAI3E,IACf,OAAOA,OAIT,KAAQA,EAAIkC,EAAKlC,IAChB,GAAK2E,EAAK3E,KAAQ4E,EACjB,OAAO5E,EAIV,OAAQ,GG5ET,IAAAhE,GAPA,SAAeuB,GACd,OAAO1B,OAAOiJ,KAAMjJ,OAAQ0B,KCrBzBuH,GAAOhH,GAmCX,IAAAiH,GAPA,WACC,OAlBD,WACC,OAA8C,KAArCD,GAAM1D,YAAe,IAAKnB,OAiB5BX,CAAM,EAAG,ICxBjB0F,QALoC,IAAhBnJ,OAAOiJ,KCAvBzF,GAAcvB,EA+BlB,IAAAC,GAPA,SAAsBR,GACrB,MAAkC,uBAAzB8B,GAAa9B,ICzBnB0H,GAAcnH,GAgClB,IC3BIoH,GD2BJC,GAZA,WACC,OAAOF,GAAa7D,WAMdgE,GEIPC,GAL2BxJ,OAAOK,UAAUoJ,qBDH5CJ,IAvBapH,GAiBGV,KAAM,OAAQ,KAW9B,IE5BIuC,GAAW7B,EACX2G,GAAQ9G,GAAmC6B,YAC3C0E,GAAYtG,GAAuC4B,YACnD+F,GAAS3F,GACT4F,GFwBaN,GE6BjB,IAAAnH,GAzBA,SAA+BR,EAAOsB,GACrC,IAAIqG,EACJ,OACC3H,YAKD2H,EAAOK,GAAOnI,KAAMG,EAAOsB,KACb2G,IAAoB7F,GAAUpC,IAIzCkH,GAFF5F,GAAYA,IAGXqF,GAAWrF,IACXA,GAAY,GACZA,EAAWtB,EAAM0C,OAGZiF,IC3BRrH,GAL2BC,GCnBvBiB,GAAajB,EACb2H,GAAuB9H,GACvBoE,GAAUnE,GACVsG,GAAYtE,GCiChB,IAAA/B,GAjBwBC,GACbH,GDQX,SAAsBJ,GACrB,OACW,OAAVA,GACiB,iBAAVA,IACNwE,GAASxE,IACc,iBAAjBA,EAAM0C,QACbiE,GAAW3G,EAAM0C,SACjB1C,EAAM0C,QAAU,GAChB1C,EAAM0C,QEHS,YFIflB,GAAYxB,EAAO,YAClBkI,GAAsBlI,EAAO,WGtC5B0H,GAAcnH,GACd9B,GAAU2B,GAKVgF,GAAQb,MAAM5F,UAAUyG,MA+B5B,IAAA+C,GAVA,SAAenI,GACd,OAAK0H,GAAa1H,GACVvB,GAAS2G,GAAMvF,KAAMG,IAEtBvB,GAASuB,ICnBjB,ICAAoI,GAZ2B7H,IDK3B,cCEuC,aCWvC8H,IAlB2B9H,GAKjB,CACT1B,SAAY,MAO0B,YCCvC,ICJI8I,GDIJW,GAPA,SAAiCtI,GAChC,OAASA,EAAM8E,aAAe9E,EAAM8E,YAAYnG,YAAcqB,GER3DuI,GAAwB,oBAAXlF,YAA2B,EAASA,ODAjD7B,GAAajB,EACbiI,GAAUpI,GACVmF,GAASlF,GACToI,GAAyBpG,GACzBqG,wPACAC,GCAaJ,GD2CjBZ,GAzBA,WACC,IAAIiB,EACJ,GAAuB,cAAlBrD,GAAQoD,IACZ,OAAO,EAER,IAAMC,KAAKD,GACV,KAEmC,IAAjCH,GAASE,GAAeE,IACxBpH,GAAYmH,GAAKC,IACJ,OAAbD,GAAKC,IACkB,WAAvBrD,GAAQoD,GAAKC,KAEbH,GAAwBE,GAAKC,IAE7B,MAAQpK,GACT,OAAO,EAGT,OAAO,EAMDqK,GAKP,IErDIlB,GAA2B,oBAAXtE,OCAhByF,GHqDanB,GGpDbc,GAAyBrI,GACzB2I,GDGapB,GCuBjB,IC5BIlD,GAAelE,GACfiB,GAAapB,EACbsH,GAAcrH,GACd2I,GAAqB3G,GACrB4G,GAAyBC,GACzBT,GDSJ,SAAkBzI,GACjB,IAAoB,IAAf+I,KAAyBD,GAC7B,OAAOL,GAAwBzI,GAEhC,IACC,OAAOyI,GAAwBzI,GAC9B,MAAQmJ,GACT,OAAO,ICfLC,iHAyEJ,IC7EI3K,GAAU4B,GACVgJ,GAAUhH,GACV/C,GDuBJ,SAAeU,GACd,IAAIsJ,EACAC,EACAC,EACA7H,EACAiH,EACAa,EACAhH,EAGJ,GADAd,EAAM,GACD+F,GAAa1H,GAAU,CAE3B,IAAMyC,EAAI,EAAGA,EAAIzC,EAAM0C,OAAQD,IAC9Bd,EAAI+H,KAAMjH,EAAE5D,YAGb,OAAO8C,EAER,GAAsB,iBAAV3B,GAEX,GAAKA,EAAM0C,OAAS,IAAMlB,GAAYxB,EAAO,KAC5C,IAAMyC,EAAI,EAAGA,EAAIzC,EAAM0C,OAAQD,IAC9Bd,EAAI+H,KAAMjH,EAAE5D,gBAGR,CAEN,IAAe,KADf2K,EAA2B,mBAAVxJ,KACQyE,GAAczE,GACtC,OAAO2B,EAER4H,EAAkBP,IAAsBQ,EAEzC,IAAMZ,KAAK5I,EACFuJ,GAAuB,cAANX,IAAuBpH,GAAYxB,EAAO4I,IAClEjH,EAAI+H,KAAM7H,OAAQ+G,IAGpB,GAAKK,GAEJ,IADAK,EAAkBb,GAAwBzI,GACpCyC,EAAI,EAAGA,EAAI2G,GAAe1G,OAAQD,IACvCgH,EAAIL,GAAgB3G,GACZ6G,GAAyB,gBAANG,IAAyBjI,GAAYxB,EAAOyJ,IACtE9H,EAAI+H,KAAM7H,OAAQ4H,IAIrB,OAAO9H,GEnDRrB,GDrBkBF,GADIG,KA6Bb8I,GAEA5K,GAGDa,GE7BRmI,QALmD,IAA/BnJ,OAAOqL,oBCAvBC,GAAgBtL,OAAOqL,oBAgC3B,IChCIpC,GAAOhH,GCgCX,IAAAD,GAjBkBC,GFUlB,SAA8BP,GAC7B,OAAO4J,GAAetL,OAAQ0B,KCA/B,SAA8BA,GAC7B,OAAOuH,GAAMjJ,OAAQ0B,KEtBtByH,QALwD,IAApCnJ,OAAOuL,yBCAvBC,GAAqBxL,OAAOuL,yBAuChC,ICvCIrI,GAAajB,ECkCjB,IAAAD,GAjBkBC,GFUlB,SAAmCP,EAAOsB,GACzC,IAAIyI,EACJ,OAAK/J,cAIa,KADlB+J,EAAOD,GAAoB9J,EAAOsB,IAF1B,KAG4ByI,GCLrC,SAAmC/J,EAAOsB,GACzC,OAAKE,GAAYxB,EAAOsB,GAChB,CACNb,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZX,MAASA,EAAOsB,IAGX,43qBErCJd,GAA0CwJ,GAK9CzG,OAAOC,QAAUhD,OCLbuE,GAAWxE,GACX0J,sCA4CJ,IAAAzJ,GA9BA,WACC,IAAImH,EACAuC,EAEJ,GAA6B,mBAAjBD,GACX,OAAO,EAGR,IAEEC,EADiC,mBAAtBD,GAAaE,KACpBF,GAAaE,KAAM,CAAE,EAAG,EAAG,EAAG,IAE9B,IAAIF,GAAc,CAAE,EAAG,EAAG,EAAG,IAElCtC,EACC5C,GAAUmF,IACC,IAAXA,EAAG,IACQ,IAAXA,EAAG,IACQ,IAAXA,EAAG,IACQ,IAAXA,EAAG,GAEH,MAAQ1L,GACTmJ,GAAO,EAER,OAAOA,GCtBRrH,GAL2BC,GCE3B,ICDIC,SCb2BwJ,ODc3B1K,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GAjB2BC,KASnBC,GAEAlB,GEjBJqI,GANapH,GACJH,GAKiB+J,MCN1BpF,GAAWxE,GACXyJ,GAAS5J,GA+Bb,IAAAI,GAVA,SAAqB4J,GACpB,IAAMrF,GAAUqF,GACf,MAAM,IAAItK,UAAW,oDAAsDsK,EAAS,KAErF,OAAOJ,GAAOG,KAAMC,IC1BjBrF,GAAWxE,GACXyJ,GAAS5J,GA+Bb,IAAAd,GAVA,SAAqB8K,GACpB,IAAMrF,GAAUqF,GACf,MAAM,IAAItK,UAAW,oDAAsDsK,EAAS,KAErF,OAAO,IAAIJ,GAAQI,ICOpB9J,GHtBiBqH,GGMNvH,GACIC,GClBXyB,GAAcvB,EAKd8J,GAAsC,mBAAdlG,UA6B5B,IClCI3D,GAA8B,mBAAd2D,UAA6BA,UAAY,KCAzDmG,GFwBJ,SAAsBtK,GACrB,OACGqK,IAAgBrK,aAAiBmE,WACV,uBAAzBrC,GAAa9B,IExBXuK,GDEa/J,GCsCjB,IAAAA,GA1BA,WACC,IAAImH,EACAP,EAEJ,GAAgC,mBAApBmD,GACX,OAAO,EAGR,IACCnD,EAAM,IAAImD,GAAiB,CAAE,EAAG,MAAO,KAAMC,MAC7C7C,EACC2C,GAAalD,IACA,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEO,MDDZA,EAAK,GAEL,MAAQ5I,GACTmJ,GAAO,EAER,OAAOA,GEvBR,ICDIlJ,GCb8B,mBAAd0F,UAA6BA,eAAY,EDczD7E,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GEjB0BC,KFSlB9B,GAEAa,GGvBJwC,GAAcvB,EAKdkK,GAAwC,mBAAfC,WA6B7B,IClCIlK,GAA+B,mBAAfkK,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuB3K,GACtB,OACGyK,IAAiBzK,aAAiB0K,YACX,wBAAzB5I,GAAa9B,IEzBX4K,GDGapK,GCuCjB,IAAAA,GA5BA,WACC,IAAImH,EACAP,EAEJ,GAAiC,mBAArBwD,GACX,OAAO,EAGR,IAECxD,EAAM,IAAIwD,GADVxD,EAAM,CAAE,EAAG,MAAO,KAAMyD,IAAaA,MAErClD,EACCgD,GAAcvD,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQyD,MAAbzD,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQ5I,GACTmJ,GAAO,EAER,OAAOA,GCxBR,ICDIlJ,GCb+B,mBAAfiM,WAA8BA,gBAAa,EDc3DpL,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GEjB2BC,KFSnB9B,GAEAa,GGvBJwC,GAAcvB,EAKduK,GAAsD,mBAAtBC,kBA6BpC,IClCIvK,GAAsC,mBAAtBuK,kBAAqCA,kBAAoB,KCAzEC,GFwBJ,SAA8BhL,GAC7B,OACG8K,IAAwB9K,aAAiB+K,mBAClB,+BAAzBjJ,GAAa9B,IE1BXiL,GDIazK,GCuCjB,IAAAA,GA7BA,WACC,IAAImH,EACAP,EAEJ,GAAwC,mBAA5B6D,GACX,OAAO,EAGR,IACC7D,EAAM,IAAI6D,GAAyB,EAAG,EAAG,EAAG,EAAG,KAAM,KAAM,IAAK,MAChEtD,EACCqD,GAAqB5D,IACR,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQ,MAAbA,EAAK,IACQ,MAAbA,EAAK,GAEL,MAAQ5I,GACTmJ,GAAO,EAER,OAAOA,GCxBR,ICDIlJ,GCbsC,mBAAtBsM,kBAAqCA,uBAAoB,EDczEzL,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GEjBkCC,KFS1B9B,GAEAa,GGvBJwC,GAAcvB,EAKd2K,GAAwC,mBAAfC,WA6B7B,IClCI3K,GAA+B,mBAAf2K,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuBpL,GACtB,OACGkL,IAAiBlL,aAAiBmL,YACX,wBAAzBrJ,GAAa9B,IExBXqL,GDEa7K,GCsCjB,IAAAA,GA1BA,WACC,IAAImH,EACAP,EAEJ,GAAiC,mBAArBiE,GACX,OAAO,EAGR,IACCjE,EAAM,IAAIiE,GAAkB,CAAE,EAAG,MAAO,KAAMC,QAC9C3D,EACCyD,GAAchE,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,QDDbA,EAAK,GAEL,MAAQ5I,GACTmJ,GAAO,EAER,OAAOA,GEvBR,ICDIlJ,GCb+B,mBAAf0M,WAA8BA,gBAAa,EDc3D7L,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GEjB2BC,KFSnB9B,GAEAa,GGvBJwC,GAAcvB,EAKdgL,GAA0C,mBAAhBC,YA6B9B,IClCIhL,GAAgC,mBAAhBgL,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBzL,GACvB,OACGuL,IAAkBvL,aAAiBwL,aACZ,yBAAzB1J,GAAa9B,IEzBX0L,GDGalL,GCuCjB,IAAAA,GA5BA,WACC,IAAImH,EACAP,EAEJ,GAAkC,mBAAtBsE,GACX,OAAO,EAGR,IAECtE,EAAM,IAAIsE,GADVtE,EAAM,CAAE,EAAG,MAAO,KAAMuE,MAAcA,QAEtChE,EACC8D,GAAerE,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQuE,QAAbvE,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQ5I,GACTmJ,GAAO,EAER,OAAOA,GCxBR,ICDIlJ,GCbgC,mBAAhB+M,YAA+BA,iBAAc,EDc7DlM,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GEjB4BC,KFSpB9B,GAEAa,GGvBJwC,GAAcvB,EAKdqL,GAAwC,mBAAfC,WA6B7B,IClCIrL,GAA+B,mBAAfqL,WAA8BA,WAAa,KCA3DC,GFwBJ,SAAuB9L,GACtB,OACG4L,IAAiB5L,aAAiB6L,YACX,wBAAzB/J,GAAa9B,IExBX+L,GDEavL,GCsCjB,IAAAA,GA1BA,WACC,IAAImH,EACAP,EAEJ,GAAiC,mBAArB2E,GACX,OAAO,EAGR,IACC3E,EAAM,IAAI2E,GAAkB,CAAE,EAAG,MAAO,KAAMC,aAC9CrE,EACCmE,GAAc1E,IACD,IAAbA,EAAK,IACQ,IAAbA,EAAK,KACS,IAAdA,EAAK,KCEQ,aDDbA,EAAK,GAEL,MAAQ5I,GACTmJ,GAAO,EAER,OAAOA,GEvBR,ICDIlJ,GCb+B,mBAAfoN,WAA8BA,gBAAa,EDc3DvM,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GEjB2BC,KFSnB9B,GAEAa,GGvBJwC,GAAcvB,EAKd0L,GAA0C,mBAAhBC,YA6B9B,IClCI1L,GAAgC,mBAAhB0L,YAA+BA,YAAc,KCA7DC,GFwBJ,SAAwBnM,GACvB,OACGiM,IAAkBjM,aAAiBkM,aACZ,yBAAzBpK,GAAa9B,IEzBXoM,GDGa5L,GCuCjB,IAAAA,GA5BA,WACC,IAAImH,EACAP,EAEJ,GAAkC,mBAAtBgF,GACX,OAAO,EAGR,IAEChF,EAAM,IAAIgF,GADVhF,EAAM,CAAE,EAAG,MAAO,KAAMiF,WAAcA,aAEtC1E,EACCwE,GAAe/E,IACF,IAAbA,EAAK,IACQ,IAAbA,EAAK,IACQiF,aAAbjF,EAAK,IACQ,IAAbA,EAAK,IACQ,IAAbA,EAAK,GAEL,MAAQ5I,GACTmJ,GAAO,EAER,OAAOA,GCxBR,ICDIlJ,GCbgC,mBAAhByN,YAA+BA,iBAAc,EDc7D5M,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GEjB4BC,KFSpB9B,GAEAa,GGvBJwC,GAAcvB,EAKd+L,GAA4C,mBAAjBC,aA6B/B,IClCI/L,GAAiC,mBAAjB+L,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyBxM,GACxB,OACGsM,IAAmBtM,aAAiBuM,cACb,0BAAzBzK,GAAa9B,IE1BXuG,GAAOnG,GACPqM,GDGajM,GCqCjB,IAAAA,GA1BA,WACC,IAAImH,EACAP,EAEJ,GAAmC,mBAAvBqF,GACX,OAAO,EAGR,IACCrF,EAAM,IAAIqF,GAAoB,CAAE,EAAK,MAAO,KAAM,OAClD9E,EACC6E,GAAgBpF,IACH,IAAbA,EAAK,IACQ,oBAAbA,EAAK,KACS,oBAAdA,EAAK,IACLA,EAAK,KAAQb,GAEb,MAAQ/H,GACTmJ,GAAO,EAER,OAAOA,GCtBR,ICDIlJ,GCbiC,mBAAjB8N,aAAgCA,kBAAe,EDc/DjN,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCqBlBK,GEjB6BC,KFSrB9B,GAEAa,GGvBJwC,GAAcvB,EAKdmM,GAA4C,mBAAjBC,aA6B/B,IClCInM,GAAiC,mBAAjBmM,aAAgCA,aAAe,KCA/DC,GFwBJ,SAAyB5M,GACxB,OACG0M,IAAmB1M,aAAiB2M,cACb,0BAAzB7K,GAAa9B,IE1BX6M,GDIarM,GCoCjB,IAAAA,GA1BA,WACC,IAAImH,EACAP,EAEJ,GAAmC,mBAAvByF,GACX,OAAO,EAGR,IACCzF,EAAM,IAAIyF,GAAoB,CAAE,EAAK,MAAO,KAAMC,MAClDnF,EACCiF,GAAgBxF,IACH,IAAbA,EAAK,IACQ,OAAbA,EAAK,KACS,OAAdA,EAAK,IACLA,EAAK,IAAQA,EAAK,GAElB,MAAQ5I,GACTmJ,GAAO,EAER,OAAOA,GCrBR,ICKIxC,GANA1G,GCbiC,mBAAjBkO,aAAgCA,kBAAe,EDc/DrN,GDPJ,WACC,MAAM,IAAIW,MAAO,oBCajBkF,GET4B5E,KFSrB9B,GAEAa,GAMR,IG7BI6E,GAAY5D,GACZmK,GAAatK,GACb2K,GAAoB1K,GACpB8K,GAAa9I,GACbmJ,GAActC,GACd2C,GAAakB,GACbb,GAAcc,GACdT,GAAeU,GACfN,GHqBaxH,GGJjB,SAAS+H,GAAW9F,GACnB,OAAO,IAAIjD,GAAWiD,GAUvB,SAAS+F,GAAY/F,GACpB,OAAO,IAAIsD,GAAYtD,GAUxB,SAASgG,GAAmBhG,GAC3B,OAAO,IAAI2D,GAAmB3D,GAU/B,SAASiG,GAAYjG,GACpB,OAAO,IAAI+D,GAAY/D,GAUxB,SAASkG,GAAalG,GACrB,OAAO,IAAIoE,GAAapE,GAUzB,SAASmG,GAAYnG,GACpB,OAAO,IAAIyE,GAAYzE,GAUxB,SAASoG,GAAapG,GACrB,OAAO,IAAI8E,GAAa9E,GAUzB,SAASqG,GAAcrG,GACtB,OAAO,IAAImF,GAAcnF,GAU1B,SAASsG,GAActG,GACtB,OAAO,IAAIuF,GAAcvF,GAgC1B,IClJI5F,GAAajB,EACbiE,GAAUpE,GACV2E,GAAW1E,GACXsN,GAAUtL,GACVkD,GAAS2D,GACT0E,GAASb,GACTvE,GAAUwE,GACVa,GAAaZ,GACbrD,GAAgBkE,GAChBhE,GAAqBiE,GACrBjH,GAAiBkH,GACjB3P,GAAiB4P,EACjBC,GAAaC,GACbC,GD+GO,CACTlB,UAAaA,GACbC,WAAcA,GACdC,kBAAqBA,GACrBC,WAAcA,GACdC,YAAeA,GACfC,WAAcA,GACdC,YAAeA,GACfC,aAAgBA,GAChBC,aAAgBA,ICQlB,SAASW,GAAUC,EAAKC,EAAMC,EAAOC,EAAMC,GAC1C,IAAIC,EACApH,EACArC,EACA6E,EACA5E,EACAyJ,EACAC,EACAvI,EACA7D,EACAqM,EAKJ,GAHAJ,GAAS,EAIO,iBAARJ,GACC,OAARA,EAEA,OAAOA,EAER,GAAKvJ,GAAUuJ,GACd,OAAOJ,GAAYI,GAEpB,GAAKX,GAASW,GACb,OAnFF,SAAoBnF,GACnB,IAEI5B,EACAwC,EACAgF,EACAH,EACApQ,EACAiE,EAPA+L,EAAQ,GACRC,EAAO,GA8BX,IArBAjQ,EAAM,IAAI2K,EAAMrE,YAAaqE,EAAM6F,SAEnCR,EAAM9E,KAAMP,GACZsF,EAAK/E,KAAMlL,GAGN2K,EAAM8F,QACVzQ,EAAIyQ,MAAQ9F,EAAM8F,OAGd9F,EAAM+F,OACV1Q,EAAI0Q,KAAO/F,EAAM+F,MAEb/F,EAAMgG,QACV3Q,EAAI2Q,MAAQhG,EAAMgG,OAEdhG,EAAMiG,UACV5Q,EAAI4Q,QAAUjG,EAAMiG,SAGrB7H,EAAOsG,GAAY1E,GACb1G,EAAI,EAAGA,EAAI8E,EAAK7E,OAAQD,IAC7BmM,EAAMrH,EAAM9E,GACZsH,EAAOD,GAAoBX,EAAOyF,GAC7BpN,GAAYuI,EAAM,WACtBgF,EAAQvK,GAAS2E,EAAOyF,IAAY,GAAK,GACzC7E,EAAK/J,MAAQqO,GAAUlF,EAAOyF,GAAOG,EAAKP,EAAOC,GAAO,IAEzDpQ,GAAgBG,EAAKoQ,EAAK7E,GAE3B,OAAOvL,EA0CC6Q,CAAWf,GAKnB,GAAc,UAFdpJ,EAAOK,GAAQ+I,IAGd,OAAO,IAAIgB,MAAOhB,GAEnB,GAAc,WAATpJ,EACJ,OAAO0I,GAAQU,EAAIzP,YAEpB,GAAc,QAATqG,EACJ,OAAO,IAAIqK,IAAKjB,GAEjB,GAAc,QAATpJ,EACJ,OAAO,IAAIsK,IAAKlB,GAEjB,GACU,WAATpJ,GACS,YAATA,GACS,WAATA,EAGA,OAAOoJ,EAAI1M,UAGZ,GADAuD,EAAOiJ,GAAalJ,GAEnB,OAAOC,EAAMmJ,GAGd,GACU,UAATpJ,GACS,WAATA,EAGA,MAA8B,mBAAlB5G,OAAOmR,OA1KrB,SAAwBnB,GACvB,IAAIE,EACAkB,EACAxK,EACAuJ,EACA1E,EACAgF,EACAF,EACApM,EAUJ,IARA+L,EAAQ,GACRC,EAAO,GAEPI,EAAMvQ,OAAOqR,OAAQ7I,GAAgBwH,IACrCE,EAAM9E,KAAM4E,GACZG,EAAK/E,KAAMmF,GAEXa,EAAQ9F,GAAe0E,GACjB7L,EAAI,EAAGA,EAAIiN,EAAMhN,OAAQD,IAC9ByC,EAAOwK,EAAOjN,GACdsH,EAAOD,GAAoBwE,EAAKpJ,GAC3B1D,GAAYuI,EAAM,WACtBgF,EAAQvK,GAAS8J,EAAIpJ,IAAY,GAAK,GACtC6E,EAAK/J,MAAQqO,GAAUC,EAAIpJ,GAAO6J,EAAKP,EAAOC,GAAO,IAEtDpQ,GAAgBwQ,EAAK3J,EAAM6E,GAW5B,OATMzL,OAAOsR,aAActB,IAC1BhQ,OAAOuR,kBAAmBhB,GAEtBvQ,OAAOwR,SAAUxB,IACrBhQ,OAAOyR,KAAMlB,GAETvQ,OAAO0R,SAAU1B,IACrBhQ,OAAOmR,OAAQZ,GAETA,EAuIEoB,CAAe3B,GAEhB,GAIR,GADA/G,EAAOsG,GAAYS,GACdI,EAAQ,EAEZ,IADAC,EAASzJ,EACH4J,EAAI,EAAGA,EAAIvH,EAAK7E,OAAQoM,IAE7BxI,EAAIgI,EADJM,EAAMrH,EAAMuH,IAIZ5J,EAAOK,GAAQe,GAED,iBAANA,GACD,OAANA,GAEU,UAATpB,GACS,WAATA,GAEDH,GAAUuB,GAEM,WAAXqI,GACJ5E,EAAOD,GAAoBwE,EAAKM,GAC3BpN,GAAYuI,EAAM,WACtBA,EAAK/J,MAAQqO,GAAU/H,IAExBjI,GAAgBkQ,EAAMK,EAAK7E,IAE3BwE,EAAMK,GAAQP,GAAU/H,IAMd,KADZ7D,EAAI+F,GAASgG,EAAOlI,KAMpBuI,EAAQrK,GAAS8B,GAAQ,IAAI/B,MAAO+B,EAAE5D,QAAW,GACjD8L,EAAM9E,KAAMpD,GACZmI,EAAK/E,KAAMmF,GACK,UAAXF,EACJJ,EAAMK,GAAQP,GAAU/H,EAAGuI,EAAKL,EAAOC,EAAMC,IAE7C3E,EAAOD,GAAoBwE,EAAKM,GAC3BpN,GAAYuI,EAAM,WACtBA,EAAK/J,MAAQqO,GAAU/H,EAAGuI,EAAKL,EAAOC,EAAMC,IAE7CrQ,GAAgBkQ,EAAMK,EAAK7E,KAd3BwE,EAAMK,GAAQH,EAAMhM,QAiBhB,GAAc,UAATyC,EACX,IAAM4J,EAAI,EAAGA,EAAIvH,EAAK7E,OAAQoM,IAE7BP,EADAK,EAAMrH,EAAMuH,IACER,EAAKM,QAGpB,IAAME,EAAI,EAAGA,EAAIvH,EAAK7E,OAAQoM,IAC7BF,EAAMrH,EAAMuH,GACZ/E,EAAOD,GAAoBwE,EAAKM,GAChCvQ,GAAgBkQ,EAAMK,EAAK7E,GAY7B,OATMzL,OAAOsR,aAActB,IAC1BhQ,OAAOuR,kBAAmBtB,GAEtBjQ,OAAOwR,SAAUxB,IACrBhQ,OAAOyR,KAAMxB,GAETjQ,OAAO0R,SAAU1B,IACrBhQ,OAAOmR,OAAQlB,GAETA,EAMR,IC3RI/J,GAAUjE,GACVqG,GAAuBxG,GAAmD6B,YAC1EsE,GAAOlG,GACPgO,GDwRaA,GCtOjB,ICpBA/N,GDCA,SAAeN,EAAO0O,GACrB,IAAI/M,EACJ,GAAKkC,UAAUnB,OAAS,EAAI,CAC3B,IAAMkE,GAAsB8H,GAC3B,MAAM,IAAI5O,UAAW,oEAAsE4O,EAAQ,MAEpG,GAAe,IAAVA,EACJ,OAAO1O,OAGR0O,EAAQnI,GAGT,OADA5E,EAAQ6C,GAASxE,GAAY,IAAIuE,MAAOvE,EAAM0C,QAAW,GAClD2L,GAAUrO,EAAO2B,EAAK,CAAC3B,GAAQ,CAAC2B,GAAM+M,IE/C1ClK,GAAUjE,GA8Bd,IC9BI2B,GDmBJ,SAAmBlC,GAClB,MACkB,iBAAVA,GACG,OAAVA,IACCwE,GAASxE,ICtBR4F,GAAaxF,GACb0G,GAAiBzG,GACjBmB,GAAaa,EACbP,GAAcoH,EAKdgH,GAAkB5R,OAAOK,UAgF7B,IAAA6B,GAvCA,SAAwBR,GACvB,IAAI+G,EAGJ,QAAM7E,GAAUlC,OAIhB+G,EAAQD,GAAgB9G,MAOtBwB,GAAYxB,EAAO,gBAGpBwB,GAAYuF,EAAO,gBACnBnB,GAAYmB,EAAMjC,cACmB,sBAArChD,GAAaiF,EAAMjC,cAGnBtD,GAAYuF,EAAO,kBACnBnB,GAAYmB,EAAMoJ,iBAIjBpJ,IAAUmJ,IAzDb,SAAmB3Q,GAClB,IAAIqP,EAGJ,IAAMA,KAAOrP,EACZ,IAAMiC,GAAYjC,EAAKqP,GACtB,OAAO,EAGT,OAAO,EAmDLwB,CAAUpQ,MCjFTkC,GCegB3B,GDdhBiB,GAAapB,EACbgC,GAAW/B,EAAsC4B,YAqCrD,wJEvCIU,GAAUpC,GACVgO,GAAOnO,GACPiQ,GFeJ,SAAmBC,EAAMC,GACxB,OAAMrO,GAAUqO,GAGX/O,GAAY+O,EAAS,SACzBD,EAAKE,IAAMD,EAAQC,KACbpO,GAAUkO,EAAKE,MACb,IAAI1Q,UAAW,qEAAuEwQ,EAAKE,IAAM,MAGrGhP,GAAY+O,EAAS,aACzBD,EAAKtB,QAAUuB,EAAQvB,SACjB5M,GAAUkO,EAAKtB,UACb,IAAIlP,UAAW,yEAA2EwQ,EAAKtB,QAAU,MAG3G,KAdC,IAAIlP,UAAW,iEAAmEyQ,EAAU,OEhBjGE,GAAWpO,GAwDf,IAAAqO,GAnCA,SAAkBH,GACjB,IAAID,EACA9R,EAGJ,GAFA8R,EAAO/B,GAAMkC,IACbjS,EAAM6R,GAAUC,EAAMC,GAErB,MAAM/R,EAEP,OAUA,WACC,IAEImS,EACAlO,EAHAyM,EAAOrL,UAAW,GAClB2M,EAAMF,EAAKE,IAAM,SAAStB,EAG9B,IAAMzM,EAAI,EAAGA,EAAIoB,UAAUnB,OAAQD,IAClC+N,GAAO,UAAYI,mBAAoB/M,UAAWpB,IAInD,OAFAkO,EAAMhO,GAAS2N,EAAKtB,QAAS,UAAWwB,GACxCG,EAAMhO,GAASgO,EAAK,WAAYzB,KCtClC2B,GCbctQ,GACCH,IDWfG,EAOAsQ,GAAA,UALAxQ,IAUA,IAAAC,GAAAuQ,GESA,ICbAvQ,GDNA,SAAyBwQ,EAAOC,GAC/B,IAAIC,EACAC,EACAxO,EAIJ,IAFAwO,EAAQH,EAAMpO,OACdsO,EAAS,EACHvO,EAAI,EAAGA,EAAIwO,EAAOxO,IAClBsO,EAAStO,GAAM,IAEnBuO,GAAUD,EAAStO,IAAQqO,EAAOrO,GAAI,IAGxC,OAAOuO,GEQR,SAASE,GAAW5K,GACnB,IAAIyI,EACAoC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAK7K,EAAEwK,OACApO,QACE,EACR,MAAM,IAAIzC,MAAOqR,GAAQ,UAY1B,OAVAF,EAAK9K,EAAEyK,QAEPhC,EAAMoC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMtC,EAEZA,EAAMqC,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMtC,EAEL,IAAIzI,EAAExB,YAAawB,EAAEiL,MAAOjL,EAAEkL,KAAML,EAAIC,EAAIK,GAAgBN,EAAIC,GAAM9K,EAAEoL"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 1f77e90..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From e9ba0d1c127fe0afe8013f39e629ee60acbca9fd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 18:46:37 +0000 Subject: [PATCH 010/131] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 33 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 687 ------ .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 30 +- benchmark/benchmark.js | 294 --- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 905 ------- 48 files changed, 2705 insertions(+), 5612 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 6726965..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,687 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the repository: - push: - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch or create new branch tag: - - name: 'Push changes to `deno` branch or create new branch tag' - run: | - SLUG=${{ github.repository }} - VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p') - if [ -z "$VERSION" ]; then - echo "Workflow job was not triggered by a new tag...." - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - else - echo "Workflow job was triggered by a new tag: $VERSION" - echo "Creating new bundle branch tag of the form $VERSION-deno" - git tag -a $VERSION-deno -m "$VERSION-deno" - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno - fi - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 2e3a8d0356e2344c58af6285d321935773a6f1f5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 03:50:58 +0000 Subject: [PATCH 011/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 330ad01..05f4ab1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From a5ef5aa5aa30c79c268a43f042ae9fc8490c25e2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 14:27:26 +0000 Subject: [PATCH 012/131] Remove files --- mod.d.ts | 394 -------- mod.js | 4 - mod.js.map | 1 - stats.html | 2689 ---------------------------------------------------- 4 files changed, 3088 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8678d0c..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,EDyBWE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,EF6B4CE,CAAgBlB,EAAIC,GAAMH,EAAEqB"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index f52a575..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 25b5d5e06c1d471f5bd032edf07451155f46e95c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 14:28:22 +0000 Subject: [PATCH 013/131] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 33 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ------ .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 30 +- benchmark/benchmark.js | 294 --- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 905 ------- 49 files changed, 2705 insertions(+), 5686 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index df2f74a..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-08-01T00:49:56.834Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 5094681..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 64db7ae17f95afac9596922be5949a04675aee3c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 03:20:30 +0000 Subject: [PATCH 014/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 330ad01..05f4ab1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From c66ec574a6b81b659fbd41d4c7fbcdc9c412d179 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 10:16:12 +0000 Subject: [PATCH 015/131] Remove files --- mod.d.ts | 394 -------- mod.js | 4 - mod.js.map | 1 - stats.html | 2689 ---------------------------------------------------- 4 files changed, 3088 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8678d0c..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,EDyBWE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,EF6B4CE,CAAgBlB,EAAIC,GAAMH,EAAEqB"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 922eb7a..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 36340aae76fe24aa43378a5291ee3a84af93203c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 10:17:03 +0000 Subject: [PATCH 016/131] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ------ .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 30 +- benchmark/benchmark.js | 294 --- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 905 ------- 49 files changed, 2705 insertions(+), 5702 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index dcede0f..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-09-01T00:45:47.067Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 5094681..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 70598521ab697686dcc83fcd62dddb1dae5a87fb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 01:12:33 +0000 Subject: [PATCH 017/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 330ad01..05f4ab1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 7da4a0c160517c33d3f864f0dd318b8e69d52db7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 13:12:16 +0000 Subject: [PATCH 018/131] Remove files --- mod.d.ts | 394 -------- mod.js | 4 - mod.js.map | 1 - stats.html | 2689 ---------------------------------------------------- 4 files changed, 3088 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8678d0c..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,EDyBWE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,EF6B4CE,CAAgBlB,EAAIC,GAAMH,EAAEqB"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 49f359d..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From fb177481bbb45f836a61b87d71b98dfea7cabf5a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 13:13:03 +0000 Subject: [PATCH 019/131] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ------ .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 30 +- benchmark/benchmark.js | 294 --- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 905 ------- 49 files changed, 2705 insertions(+), 5702 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index a17f9d3..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-10-01T01:10:13.743Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 29bf533..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a7a7f51..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.9.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 39b1613..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 7ca169c..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '0 8 * * 6' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "::set-output name=package_name::$name" - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "::set-output name=data::$data" - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v2 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v2 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 5094681..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "::set-output name=remote-exists::true" - else - echo "::set-output name=remote-exists::false" - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v2 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "::set-output name=alias::${alias}" - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 0acffd9779584a78f6663e1a74b847672375ba08 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 03:24:22 +0000 Subject: [PATCH 020/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 330ad01..05f4ab1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 600ce6e25295c275507746d8fc570e2f8275ef2e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 10:56:31 +0000 Subject: [PATCH 021/131] Remove files --- mod.d.ts | 394 -------- mod.js | 4 - mod.js.map | 1 - stats.html | 2689 ---------------------------------------------------- 4 files changed, 3088 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8678d0c..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,EDyBWE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,EF6B4CE,CAAgBlB,EAAIC,GAAMH,EAAEqB"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 46efe38..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From d9c2f74422baf66f7be595be755deba9cb2426c5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 10:57:29 +0000 Subject: [PATCH 022/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ---- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 - .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 30 +- benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 905 ----- 49 files changed, 4060 insertions(+), 5702 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index f33e717..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-01T00:56:40.836Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9113bfe..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,760 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 039d1b1a9c8b620c15955b8b7cdfee7fa7959ed2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 3 Nov 2022 23:38:11 +0000 Subject: [PATCH 023/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 330ad01..05f4ab1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 409d60cab5310cdf4c79e6ac089667e1b2e288d6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 12:28:58 +0000 Subject: [PATCH 024/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4044 ---------------------------------------------------- 4 files changed, 4443 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8678d0c..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 95a3273..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 8b78180f058706c6e2224bdcd12635aef51997fe Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 12:29:51 +0000 Subject: [PATCH 025/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 781 ---- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 - .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 30 +- benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 905 ----- 49 files changed, 4060 insertions(+), 5723 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index a23c50e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-03T21:08:14.097Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 37ddb4f..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,781 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 9f2e9caaea530d042aca4b082160b7cedf5804f7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 03:22:36 +0000 Subject: [PATCH 026/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index fa21a6f..fb33e33 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 75630c52bdd7a0439aeda561a28cfe05fec26540 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 16:30:18 +0000 Subject: [PATCH 027/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4044 ---------------------------------------------------- 4 files changed, 4443 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8678d0c..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index bfec07b..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From ec1df319d31d9de6739d164b3373623f68ec8120 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 16:31:18 +0000 Subject: [PATCH 028/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 781 ---- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 183 - .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 30 +- benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 905 ----- 49 files changed, 4060 insertions(+), 5728 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index a324c1b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-12-01T00:58:36.194Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 37ddb4f..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,781 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 356acc087f812c50a78eeb1e5435c185c07809e5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 01:58:30 +0000 Subject: [PATCH 029/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 9073cd0..ec2ddc1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From b988e5b048983650273ae5bcba3b0840787261ea Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 08:22:15 +0000 Subject: [PATCH 030/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4044 ---------------------------------------------------- 4 files changed, 4443 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8678d0c..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index b898da9..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From dcdad77523864e1a054041e36b561541d0674b26 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 08:23:20 +0000 Subject: [PATCH 031/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 791 ---- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 184 - .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 30 +- benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 905 ----- 49 files changed, 4060 insertions(+), 5739 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 81960e0..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-01-01T00:45:54.031Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4eea88..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,791 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From bb25846f452518f82003ff2d9e8c909f224b52b5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 03:28:41 +0000 Subject: [PATCH 032/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 9073cd0..ec2ddc1 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.x", - "@stdlib/types": "^0.0.x" + "@stdlib/types": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.x", @@ -103,4 +104,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 87eb218fb02a5f7f9ff6c01ecbeaf53d4720bfb9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 14:14:26 +0000 Subject: [PATCH 033/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4044 ---------------------------------------------------- 4 files changed, 4443 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 0d326bf..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index a15f5de..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From cc204999f35f105af307980a12c8dece1a9cacf2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 14:15:14 +0000 Subject: [PATCH 034/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 791 --- .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 184 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 905 --- 49 files changed, 6193 insertions(+), 5739 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index f7969d9..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-02-01T00:55:11.871Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4eea88..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,791 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\"/\"@stdlib\/error-tools-fmtprodmsg\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^0.0.x'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 11973f0d57e1002112997b40a57dd6561da811a3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 02:20:56 +0000 Subject: [PATCH 035/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 7ff550e..029d0fe 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.8", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.6", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 21f2ae7ec7c554a53a5883e0ad4f6081f47e68f2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 05:40:27 +0000 Subject: [PATCH 036/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 0d326bf..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ab04bf1..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 91e2d7077358c489776499f5014b248e15587496 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 05:41:10 +0000 Subject: [PATCH 037/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 236 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 905 --- 49 files changed, 6193 insertions(+), 5874 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index cb23599..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-03-01T01:33:49.600Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 176141478a4cc51a3ddeaee4cf887c0a1847c377 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 02:23:02 +0000 Subject: [PATCH 038/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 7ff550e..029d0fe 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.8", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.6", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 7cecdffeb4abd665d27f271e7abdf1052993d764 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 05:27:13 +0000 Subject: [PATCH 039/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 0d326bf..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c2d4f38..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 77c8da9ce925750871ab4e5dc4f768331be489ad Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 05:28:13 +0000 Subject: [PATCH 040/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 905 --- 49 files changed, 6193 insertions(+), 5880 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 701d267..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-04-01T01:39:57.769Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 65d19fcdfb46337ebd0c8d31f279b52ac9385f14 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 02:18:23 +0000 Subject: [PATCH 041/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 7ff550e..029d0fe 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.8", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.6", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 602b09d3df06722f68076cf5738eafbf51041418 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 05:17:25 +0000 Subject: [PATCH 042/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 0d326bf..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 40c5587..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c98037895cb06dfb6d287c2826d139e9104d73aa Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 05:18:36 +0000 Subject: [PATCH 043/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 905 --- 49 files changed, 6193 insertions(+), 5880 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index ae685e1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-05-01T01:36:35.314Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 63a1e1f14d87453d59e40c08896daad3d4492216 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 02:19:59 +0000 Subject: [PATCH 044/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 7ff550e..029d0fe 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.8", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.6", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c1c47d2bb5ac048ec727fe558fb30abbc03ef53f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 05:30:55 +0000 Subject: [PATCH 045/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 0d326bf..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index de4c3b4..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f60d7451e2a2bcb18485cdeed46c09b9085bc49d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 05:31:52 +0000 Subject: [PATCH 046/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 905 --- 49 files changed, 6193 insertions(+), 5880 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index ec2d14d..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-06-01T01:36:52.493Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 9545a231a9985d3a8799ebef8359bb9329bff7eb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 02:19:43 +0000 Subject: [PATCH 047/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 7ff550e..029d0fe 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.8", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.6", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 704caa9dc07233bbee468f77602a990b3e8af27a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 05:35:12 +0000 Subject: [PATCH 048/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 0d326bf..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 45329c6..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 113bf562a8cf18b969bfc07f6984dfd140d93403 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 05:36:18 +0000 Subject: [PATCH 049/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 905 --- 49 files changed, 6193 insertions(+), 5880 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index d6e0656..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-07-01T01:37:03.247Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 12cc37e24ef4e592fa32903081de085beb5d31c5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 02:27:53 +0000 Subject: [PATCH 050/131] Transform error messages --- lib/main.js | 4 +++- package.json | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..f041197 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,8 @@ 'use strict'; +var format = require( '@stdlib/error-tools-fmtprodmsg' ); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); @@ -62,7 +64,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format( '0Mi0c' ) ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! diff --git a/package.json b/package.json index 7ff550e..029d0fe 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.8", - "@stdlib/types": "^0.0.14" + "@stdlib/types": "^0.0.14", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.6", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f4a19ea48ef2f0190f2ddd76dc6d441feba0aba2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 05:37:12 +0000 Subject: [PATCH 051/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 0d326bf..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c518908..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 79d8532e76979f3de5a1709c1ca37a65b299a0d5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 05:38:06 +0000 Subject: [PATCH 052/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 85 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 905 --- 49 files changed, 6193 insertions(+), 5880 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 50b6b5e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-08-01T01:39:51.616Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 334eb59..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From ea9cb0ef8c9fd25bafef4779a878df785cfcef3c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 22 Sep 2023 23:11:52 +0000 Subject: [PATCH 053/131] Transform error messages --- lib/main.js | 6 +++--- package.json | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..ac75076 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,11 +18,12 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); - // MAIN // /** @@ -62,7 +63,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c,E2') ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! @@ -77,7 +78,6 @@ function transpose( x ) { return new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 3d805e2..594ea10 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.0.8", - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.0" }, "devDependencies": { "@stdlib/array-complex128": "^0.0.6", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f0513853df212f493c5ea56a9fc694205030a7bf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 22 Sep 2023 23:49:24 +0000 Subject: [PATCH 054/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8ba190a..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 2.0 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 0d326bf..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format( '0Mi0c' ) );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAyDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MCjCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDwBmBE,CAAQ,UAY1B,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EE1ChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF4BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4179418..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 204f80243f7cc54bed0347d9b405d9f84b58ec76 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 22 Sep 2023 23:50:18 +0000 Subject: [PATCH 055/131] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 783 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 83 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 905 --- 52 files changed, 6193 insertions(+), 5926 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 06a9a75..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index a00dbe5..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,56 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - uses: styfle/cancel-workflow-action@0.11.0 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 0606d8e..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,44 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 7902a7d..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,62 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout the repository' - uses: actions/checkout@v3 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 372f2ed..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,108 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 91f2b93..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,783 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 7b87598891b304df649423406bd62abff06f6fa1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 00:10:18 +0000 Subject: [PATCH 056/131] Update README.md for Deno bundle v0.1.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c4fe13..542fc93 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.1.0-deno/mod.js'; ``` #### transpose( x ) @@ -112,7 +112,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.1.0-deno/mod.js'; function print( arr, name ) { var str; From 9f30ae25ba0230364ff90e2134173466f01f5a01 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 00:10:18 +0000 Subject: [PATCH 057/131] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 542fc93..2c59d98 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +``` +The previous example will load the latest bundled code from the deno branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/ndarray-base-transpose/tags). For example, + ```javascript import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.1.0-deno/mod.js'; ``` @@ -112,7 +117,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.1.0-deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; function print( arr, name ) { var str; From 20f7f2d18283251cd1d8d4cff228f7b863bb90d5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Oct 2023 02:47:36 +0000 Subject: [PATCH 058/131] Transform error messages --- lib/main.js | 6 +++--- package.json | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..ac75076 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,11 +18,12 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); - // MAIN // /** @@ -62,7 +63,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c,E2') ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! @@ -77,7 +78,6 @@ function transpose( x ) { return new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 545a779..5db56f6 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.1.0", - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.0" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From c1190b4597b4d3564aea45da1c0be5284067ae77 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Oct 2023 21:14:02 +0000 Subject: [PATCH 059/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 83e1011..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c,E2') );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAwDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MChCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDuBmBE,CAAO,aAYzB,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EEzChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF2BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 32221c4..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 3cf0f51e7108cbafe9464b9688040c75c64e5830 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Oct 2023 21:15:13 +0000 Subject: [PATCH 060/131] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 83 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 905 --- test/test.js | 905 --- 54 files changed, 6193 insertions(+), 6890 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 6741cec..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T01:21:26.205Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index bb38904..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a25329a..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From b27bf7b4b1f6dbc800c3344e23c21f507fd21e65 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 4 Oct 2023 02:29:27 +0000 Subject: [PATCH 061/131] Transform error messages --- lib/main.js | 6 +++--- package.json | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..ac75076 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,11 +18,12 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); - // MAIN // /** @@ -62,7 +63,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c,E2') ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! @@ -77,7 +78,6 @@ function transpose( x ) { return new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 74081b3..400e4cd 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.1.1", - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 08e0f31621ff7fff95f1e9db1e328901bb663247 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 4 Oct 2023 11:48:06 +0000 Subject: [PATCH 062/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 83e1011..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c,E2') );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAwDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MChCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDuBmBE,CAAO,aAYzB,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EEzChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF2BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index aac547a..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e4e654fd3566186933d22c5ffa248d1e3d51d732 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 4 Oct 2023 11:49:10 +0000 Subject: [PATCH 063/131] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 83 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 905 --- test/test.js | 905 --- 53 files changed, 6193 insertions(+), 6889 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index bb38904..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a25329a..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 3f9182a009d42dd8e1388ff5ffb6ef7c737bde64 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 4 Oct 2023 15:52:18 +0000 Subject: [PATCH 064/131] Update README.md for Deno bundle v0.1.1 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0f025af..dd03a73 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.1.1-deno/mod.js'; ``` #### transpose( x ) @@ -112,7 +112,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.1.1-deno/mod.js'; function print( arr, name ) { var str; From 58b18980ecb63142811ff748e169d5f6922e02ad Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 4 Oct 2023 15:52:18 +0000 Subject: [PATCH 065/131] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd03a73..66a5a5a 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +``` +The previous example will load the latest bundled code from the deno branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/ndarray-base-transpose/tags). For example, + ```javascript import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.1.1-deno/mod.js'; ``` @@ -112,7 +117,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.1.1-deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; function print( arr, name ) { var str; From cac4606f778cb16905b3bda6de2b4ee824cf9f7b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 04:56:09 +0000 Subject: [PATCH 066/131] Transform error messages --- lib/main.js | 6 +++--- package.json | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 5fd3488..ac75076 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,11 +18,12 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); - // MAIN // /** @@ -62,7 +63,7 @@ function transpose( x ) { sh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances! N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c,E2') ); } st = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances! @@ -77,7 +78,6 @@ function transpose( x ) { return new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index eaeb7b0..054e039 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "dependencies": { "@stdlib/ndarray-base-strides2offset": "^0.1.1", - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -103,4 +104,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ae4f6ff7113328ff883e66dce8539e288c0332df Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 22:48:15 +0000 Subject: [PATCH 067/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 83e1011..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c,E2') );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAwDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MChCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDuBmBE,CAAO,aAYzB,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EEzChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF2BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index f48ae72..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 3b08f2344debff069dad7711b91ec338151d5ecd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 22:49:23 +0000 Subject: [PATCH 068/131] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 83 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 78 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 905 --- test/test.js | 905 --- 53 files changed, 6193 insertions(+), 6889 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index bb38904..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a25329a..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From c614306843857b0ce015561d637ff74ccc14b9a6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Oct 2023 20:27:35 +0000 Subject: [PATCH 069/131] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b8d956a..e8bac56 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "github:stdlib-js/ndarray-base-shape#main", "@stdlib/ndarray-base-strides": "github:stdlib-js/ndarray-base-strides#main", "@stdlib/ndarray-base-strides2offset": "^0.1.1", - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 854be4fb356d4f5ab8fc3df645386800efe6a81f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Oct 2023 20:32:04 +0000 Subject: [PATCH 070/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 83e1011..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var t,e,n,o;if((o=(e=r.shape).length)<2)throw new Error(function(){var r,t=arguments,e="https://stdlib.io/e/"+t[0]+"?";for(r=1;r\n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = x.shape; // WARNING: we assume that `sh` is a copy, which is true of `ndarray` instances!\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c,E2') );\n\t}\n\tst = x.strides; // WARNING: we assume that `st` is a copy, which is true of `ndarray` instances!\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\treturn new x.constructor( x.dtype, x.data, sh, st, strides2offset( sh, st ), x.order ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["transpose","x","tmp","sh","st","N","shape","length","Error","i","a","arguments","u","encodeURIComponent","format","strides","constructor","dtype","data","offset","ndims","strides2offset","order"],"mappings":";;AAwDA,SAASA,EAAWC,GACnB,IAAIC,EACAC,EACAC,EACAC,EAIJ,IADAA,GADAF,EAAKF,EAAEK,OACAC,QACE,EACR,MAAM,IAAIC,MChCZ,WACC,IAGIC,EAHAC,EAAIC,UAEJC,EAAI,uBADAF,EAAG,GACsB,IAEjC,IAAMD,EAAI,EAAGA,EAAIC,EAAEH,OAAQE,IAC1BG,GAAK,UAAYC,mBAAoBH,EAAGD,IAEzC,OAAOG,CACR,CDuBmBE,CAAO,aAYzB,OAVAV,EAAKH,EAAEc,QAEPb,EAAMC,EAAIE,EAAE,GACZF,EAAIE,EAAE,GAAMF,EAAIE,EAAE,GAClBF,EAAIE,EAAE,GAAMH,EAEZA,EAAME,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMH,EAEL,IAAID,EAAEe,YAAaf,EAAEgB,MAAOhB,EAAEiB,KAAMf,EAAIC,EEzChD,SAAyBE,EAAOS,GAC/B,IAAII,EACAC,EACAX,EAIJ,IAFAW,EAAQd,EAAMC,OACdY,EAAS,EACHV,EAAI,EAAGA,EAAIW,EAAOX,IAClBM,EAASN,GAAM,IAEnBU,GAAUJ,EAASN,IAAQH,EAAOG,GAAI,IAGxC,OAAOU,CACR,CF2BoDE,CAAgBlB,EAAIC,GAAMH,EAAEqB,MAChF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 2b7e982..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 95bb9a0dcbe54e415b9197bb9a02073e960b8e39 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Oct 2023 20:33:27 +0000 Subject: [PATCH 071/131] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 247 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 89 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 905 --- test/test.js | 905 --- 53 files changed, 6193 insertions(+), 6900 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index bb38904..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a25329a..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 225f1ab9630d61e84b5a45749853b84530f55ab0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Nov 2023 17:04:31 +0000 Subject: [PATCH 072/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..e713258 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c,E2') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 241c927..400355e 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.1.0", "@stdlib/ndarray-base-strides": "^0.1.0", "@stdlib/ndarray-base-strides2offset": "^0.1.1", - "@stdlib/types": "^0.1.0" + "@stdlib/types": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f04144219fa478ebb8da9c7cb71779add2855f56 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 01:34:31 +0000 Subject: [PATCH 073/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 02abeb6..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var n,t,o;for(t=r.length,n=[],o=0;ou&&(e=!1),!e&&!t)return 0;u=a}return e&&t?3:e?1:2}(t),1===o||3===o?"row-major":2===o?"column-major":0===r.shape.length?"row-major":null)}function o(n){var o,e,u,a;if(e=function(n,t){var o=n.shape;return t?r(o):o}(n,!0),(a=e.length)<2)throw new Error("invalid argument. Must provide an ndarray having two or more dimensions.");return u=function(n,t){var o=n.strides;return t?r(o):o}(n,!0),o=e[a-2],e[a-2]=e[a-1],e[a-1]=o,o=u[a-2],u[a-2]=u[a-1],u[a-1]=o,new n.constructor(function(r){return r.dtype}(n),function(r){return r.data}(n),e,u,function(r,n){var t,o,e;for(o=r.length,t=0,e=0;e s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar st = x.strides;\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","abs","Math","order","st","o","strides","column","ndims","row","s1","s2","strides2order","shape","transpose","tmp","sh","N","copyIndexed","getShape","Error","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":";;AAgCA,SAASA,EAAMC,GACd,IAAIC,EACAC,EACAC,EAIJ,IAFAD,EAAMF,EAAEI,OACRH,EAAM,GACAE,EAAI,EAAGA,EAAID,EAAKC,IACrBF,EAAII,KAAML,EAAGG,IAEd,OAAOF,CACR,CCKA,SAASK,EAAKN,GACb,OAAOO,KAAKD,IAAKN,EAClB,CCDA,SAASQ,EAAOR,GACf,IAAIS,EACAC,EAGJ,MAAkB,iBADlBA,EAAIV,EAAEQ,OAEEE,EAIW,iBADnBD,EAAKT,EAAEW,UAC+B,OAAPF,EAhChB,aAmCfC,ECdD,SAAwBC,GACvB,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAb,EAGJ,GAAe,KADfU,EAAQF,EAAQP,QAEf,OAAO,EAMR,IAJAQ,GAAS,EACTE,GAAM,EAENC,EAAKT,EAAKK,EAAS,IACbR,EAAI,EAAGA,EAAIU,EAAOV,IAAM,CAO7B,GANAa,EAAKV,EAAKK,EAASR,IACdS,GAAUI,EAAKD,EACnBH,GAAS,EACEE,GAAOE,EAAKD,IACvBD,GAAM,IAEFA,IAAOF,EAGX,OAAO,EAFPG,EAAKC,CAIN,CACD,OAAKF,GAAOF,EACJ,EAEHE,EACG,EAED,CACR,CDtBKG,CAAeR,GACR,IAANC,GAAiB,IAANA,EApCD,YAuCJ,IAANA,EAtCa,eA0CM,IAAnBV,EAAEkB,MAAMd,OA3CE,YA+CR,KACR,CEfA,SAASe,EAAWnB,GACnB,IAAIoB,EACAC,EACAZ,EACAa,EAIJ,GAFAD,EC1BD,SAAgBrB,EAAGD,GAClB,IAAIsB,EAAKrB,EAAEkB,MACX,OAAKnB,EACGwB,EAAaF,GAEdA,CACR,CDoBMG,CAAUxB,GAAG,IAClBsB,EAAID,EAAGjB,QACE,EACR,MAAM,IAAIqB,MAAO,4EAalB,OAXAhB,EE/BD,SAAkBT,EAAGD,GACpB,IAAIU,EAAKT,EAAEW,QACX,OAAKZ,EACGwB,EAAad,GAEdA,CACR,CFyBMiB,CAAY1B,GAAG,GAEpBoB,EAAMC,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMF,EAEZA,EAAMX,EAAIa,EAAE,GACZb,EAAIa,EAAE,GAAMb,EAAIa,EAAE,GAClBb,EAAIa,EAAE,GAAMF,EAGL,IAAIpB,EAAE2B,YG5Cd,SAAgB3B,GACf,OAAOA,EAAE4B,KACV,CH0C2BC,CAAU7B,GI5CrC,SAAeA,GACd,OAAOA,EAAE8B,IACV,CJ0C0CC,CAAS/B,GAAKqB,EAAIZ,EK9C5D,SAAyBS,EAAOP,GAC/B,IAAIqB,EACAnB,EACAV,EAIJ,IAFAU,EAAQK,EAAMd,OACd4B,EAAS,EACH7B,EAAI,EAAGA,EAAIU,EAAOV,IAClBQ,EAASR,GAAM,IAEnB6B,GAAUrB,EAASR,IAAQe,EAAOf,GAAI,IAGxC,OAAO6B,CACR,CLgCgEC,CAAgBZ,EAAIZ,GAAMyB,EAAUlC,GACpG"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index cee871d..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 78376d8df3ef33bb24d27a9dcc1e5d7d65fae582 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 01:35:30 +0000 Subject: [PATCH 074/131] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 30 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 --- 54 files changed, 6193 insertions(+), 6038 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index fc4c8bb..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-11-01T05:30:57.851Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index bb38904..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 35dc9986eff6c98f89db34b141fb8e24deb90565 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 9 Nov 2023 11:27:02 +0000 Subject: [PATCH 075/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..e713258 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c,E2') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index da181db..6641ec4 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.1.0", "@stdlib/ndarray-base-strides": "^0.1.0", "@stdlib/ndarray-base-strides2offset": "^0.1.1", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 46f7b9d5842f3e895516ca35b8a2da9a013db1c2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 9 Nov 2023 14:57:15 +0000 Subject: [PATCH 076/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index ac66f0d..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=g.call(t,y,"$1e"),t=g.call(t,m,"e"),t=g.call(t,b,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=g.call(t,h,"e+0$1"),t=g.call(t,d,"e-0$1"),r.alternate&&(t=g.call(t,w,"$1."),t=g.call(t,v,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===f.call(r.specifier)?f.call(t):p.call(t)}function j(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=x(o)?String(n.arg):k(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=_(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=E(n.arg,n.width,n.padRight)),c+=n.arg||"",u+=1}return c}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function I(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function A(r){var e,t,n,i;for(t=[],i=0,n=F.exec(r);n;)(e=r.slice(i,F.lastIndex-n[0].length)).length&&t.push(e),t.push(I(n)),i=F.lastIndex,n=F.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function C(r){return"string"==typeof r}function T(r){var e,t,n;if(!C(r))throw new TypeError(T("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=A(r),(t=new Array(arguments.length))[0]=e,n=1;n=0;i--)t[i]=n,n*=r[i];return t}(r)}R=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===Z.call(r))throw new TypeError(T("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===Z.call(t))throw new TypeError(T("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(L.call(r,e)||U.call(r,e)?(n=r.__proto__,r.__proto__=P,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&G&&G.call(r,e,t.get),o&&W&&W.call(r,e,t.set),r},O=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},R(M,"assign",{configurable:!1,enumerable:!1,writable:!1,value:O});function N(r){return Math.abs(r)}function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?"row-major":(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=N(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?"row-major":2===t?"column-major":0===r.shape.length?"row-major":null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar tokens;\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\ttokens = tokenize( str );\n\targs = new Array( arguments.length );\n\targs[ 0 ] = tokens;\n\tfor ( i = 1; i < args.length; i++ ) {\n\t\targs[ i ] = arguments[ i ];\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c,E2') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst= x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","isString","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","spacePad","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 3466947..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2b2d62ebc99bf45fc06beac1d77f16d7328bf873 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 9 Nov 2023 14:58:46 +0000 Subject: [PATCH 077/131] Auto-generated commit --- .editorconfig | 186 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 32 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 --- 53 files changed, 6194 insertions(+), 6038 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 13e9c39..0000000 --- a/.editorconfig +++ /dev/null @@ -1,186 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index bb38904..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 5ef0880c7084baf91839b02fce8b8ded2341b1d7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 13:15:31 +0000 Subject: [PATCH 078/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..e713258 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c,E2') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index c4485e6..70ebf42 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.1.0", "@stdlib/ndarray-base-strides": "^0.1.0", "@stdlib/ndarray-base-strides2offset": "^0.1.1", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From bad004f7f95fb001ea6d141847b0b128e0bb9f98 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 11:22:49 +0000 Subject: [PATCH 079/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index ac66f0d..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=g.call(t,y,"$1e"),t=g.call(t,m,"e"),t=g.call(t,b,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=g.call(t,h,"e+0$1"),t=g.call(t,d,"e-0$1"),r.alternate&&(t=g.call(t,w,"$1."),t=g.call(t,v,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===f.call(r.specifier)?f.call(t):p.call(t)}function j(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=x(o)?String(n.arg):k(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=_(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=E(n.arg,n.width,n.padRight)),c+=n.arg||"",u+=1}return c}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function I(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function A(r){var e,t,n,i;for(t=[],i=0,n=F.exec(r);n;)(e=r.slice(i,F.lastIndex-n[0].length)).length&&t.push(e),t.push(I(n)),i=F.lastIndex,n=F.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function C(r){return"string"==typeof r}function T(r){var e,t,n;if(!C(r))throw new TypeError(T("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=A(r),(t=new Array(arguments.length))[0]=e,n=1;n=0;i--)t[i]=n,n*=r[i];return t}(r)}R=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===Z.call(r))throw new TypeError(T("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===Z.call(t))throw new TypeError(T("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(L.call(r,e)||U.call(r,e)?(n=r.__proto__,r.__proto__=P,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&G&&G.call(r,e,t.get),o&&W&&W.call(r,e,t.set),r},O=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},R(M,"assign",{configurable:!1,enumerable:!1,writable:!1,value:O});function N(r){return Math.abs(r)}function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?"row-major":(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=N(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?"row-major":2===t?"column-major":0===r.shape.length?"row-major":null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar tokens;\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\ttokens = tokenize( str );\n\targs = new Array( arguments.length );\n\targs[ 0 ] = tokens;\n\tfor ( i = 1; i < args.length; i++ ) {\n\t\targs[ i ] = arguments[ i ];\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c,E2') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst= x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","isString","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","spacePad","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4eb321a..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a39f92aab3c32d010b7016b9caab1321061c5b05 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 11:23:38 +0000 Subject: [PATCH 080/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 32 +- benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 --- 54 files changed, 6194 insertions(+), 6034 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index fc9ec45..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T05:35:35.248Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index ab56cca..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c1c45e7..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index bb38904..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA corresponding to v3.0.3: - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 265afda..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA corresponding to v4.1.0 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 899d6e2c1e8eb083efd0861dd668c1dd24f4e59f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 07:54:34 +0000 Subject: [PATCH 081/131] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index faf8964..9306acf 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.1.0", "@stdlib/ndarray-base-strides": "^0.1.0", "@stdlib/ndarray-base-strides2offset": "^0.1.1", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f1859b029cd09473d8eed1cc8bdd05bde74f6ea1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 14:30:23 +0000 Subject: [PATCH 082/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index ac66f0d..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=g.call(t,y,"$1e"),t=g.call(t,m,"e"),t=g.call(t,b,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=g.call(t,h,"e+0$1"),t=g.call(t,d,"e-0$1"),r.alternate&&(t=g.call(t,w,"$1."),t=g.call(t,v,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===f.call(r.specifier)?f.call(t):p.call(t)}function j(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=x(o)?String(n.arg):k(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=_(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=E(n.arg,n.width,n.padRight)),c+=n.arg||"",u+=1}return c}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function I(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function A(r){var e,t,n,i;for(t=[],i=0,n=F.exec(r);n;)(e=r.slice(i,F.lastIndex-n[0].length)).length&&t.push(e),t.push(I(n)),i=F.lastIndex,n=F.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function C(r){return"string"==typeof r}function T(r){var e,t,n;if(!C(r))throw new TypeError(T("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=A(r),(t=new Array(arguments.length))[0]=e,n=1;n=0;i--)t[i]=n,n*=r[i];return t}(r)}R=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===Z.call(r))throw new TypeError(T("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===Z.call(t))throw new TypeError(T("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(L.call(r,e)||U.call(r,e)?(n=r.__proto__,r.__proto__=P,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&G&&G.call(r,e,t.get),o&&W&&W.call(r,e,t.set),r},O=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},R(M,"assign",{configurable:!1,enumerable:!1,writable:!1,value:O});function N(r){return Math.abs(r)}function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?"row-major":(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=N(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?"row-major":2===t?"column-major":0===r.shape.length?"row-major":null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar tokens;\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\ttokens = tokenize( str );\n\targs = new Array( arguments.length );\n\targs[ 0 ] = tokens;\n\tfor ( i = 1; i < args.length; i++ ) {\n\t\targs[ i ] = arguments[ i ];\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c,E2') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst= x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","isString","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","spacePad","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 1fff687..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 10682e1647ce86667d33379d0ba32ec2880a365a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 14:31:09 +0000 Subject: [PATCH 083/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 32 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 89 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 --- 55 files changed, 6194 insertions(+), 6039 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 677209c..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T05:05:08.759Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 30656c4..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c92f5c4..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index c16f1d9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 219d132f67d657995a368c32c91b3b17231c59d8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 08:24:33 +0000 Subject: [PATCH 084/131] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index faf8964..9306acf 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.1.0", "@stdlib/ndarray-base-strides": "^0.1.0", "@stdlib/ndarray-base-strides2offset": "^0.1.1", - "@stdlib/types": "^0.2.0" + "@stdlib/types": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From cf13c917500cd1609df52603e510d5e1cd20adf1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 13:46:25 +0000 Subject: [PATCH 085/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index ef9b830..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( `@stdlib/array/complex128` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( `@stdlib/array/complex64` ); -* var ndarray = require( `@stdlib/ndarray/ctor` ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( `@stdlib/ndarray/array` ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index e638ef7..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=g.call(t,y,"$1e"),t=g.call(t,m,"e"),t=g.call(t,b,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=g.call(t,d,"e+0$1"),t=g.call(t,h,"e-0$1"),r.alternate&&(t=g.call(t,w,"$1."),t=g.call(t,v,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===f.call(r.specifier)?f.call(t):p.call(t)}function j(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=x(o)?String(n.arg):k(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=_(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=E(n.arg,n.width,n.padRight)),s+=n.arg||"",u+=1}return s}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function A(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function I(r){var e,t,n,i;for(t=[],i=0,n=F.exec(r);n;)(e=r.slice(i,F.lastIndex-n[0].length)).length&&t.push(e),t.push(A(n)),i=F.lastIndex,n=F.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function T(r){return"string"==typeof r}function C(r){var e,t,n;if(!T(r))throw new TypeError(C("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=I(r),(t=new Array(arguments.length))[0]=e,n=1;n=0;i--)t[i]=n,n*=r[i];return t}(r)}R=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===Z.call(r))throw new TypeError(C("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===Z.call(t))throw new TypeError(C("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(L.call(r,e)||M.call(r,e)?(n=r.__proto__,r.__proto__=P,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&G&&G.call(r,e,t.get),o&&W&&W.call(r,e,t.set),r},O=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},R(N,"assign",{configurable:!1,enumerable:!1,writable:!1,value:O});function U(r){return Math.abs(r)}function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?"row-major":(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?"row-major":2===t?"column-major":0===r.shape.length?"row-major":null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error("invalid argument. Must provide an ndarray having two or more dimensions.");return i=function(e,t){var n,i,a;return"object"!=typeof(a=e.strides)||null===a?0===(i=e.shape).length?[0]:("string"!=typeof(n=e.order)&&(n="row-major"),N(i,n)):t?r(a):a}(e,!0),t=n[a-2],n[a-2]=n[a-1],n[a-1]=t,t=i[a-2],i[a-2]=i[a-1],i[a-1]=t,new e.constructor(function(r){return r.dtype}(e),function(r){return r.data}(e),n,i,function(r,e){var t,n,i;for(n=r.length,t=0,i=0;i 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar tokens;\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\ttokens = tokenize( str );\n\targs = new Array( arguments.length );\n\targs[ 0 ] = tokens;\n\tfor ( i = 1; i < args.length; i++ ) {\n\t\targs[ i ] = arguments[ i ];\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst= x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","isString","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","spacePad","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 2ce7292..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8a33cd42cdcabc4eff7d92fcb8048a34b5e8c3eb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 13:46:50 +0000 Subject: [PATCH 086/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 128 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 89 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 --- 55 files changed, 6194 insertions(+), 6044 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index e4167a1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T05:53:37.588Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 30656c4..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 3acd3a9..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA corresponding to v0.11.0 - uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index c92f5c4..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index c16f1d9..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index e1e3539..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA corresponding to v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 80949792030d2346fff22642264a7850518a2803 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 23:56:08 +0000 Subject: [PATCH 087/131] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7e91650..fdde1a3 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.0", "@stdlib/ndarray-base-strides": "^0.2.0", "@stdlib/ndarray-base-strides2offset": "^0.2.0", - "@stdlib/types": "^0.3.1" + "@stdlib/types": "^0.3.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/array-complex128": "^0.1.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 52a04823d33ffa4718a84a9076c67c552bc2a932 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 02:24:43 +0000 Subject: [PATCH 088/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index e638ef7..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=g.call(t,y,"$1e"),t=g.call(t,m,"e"),t=g.call(t,b,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=g.call(t,d,"e+0$1"),t=g.call(t,h,"e-0$1"),r.alternate&&(t=g.call(t,w,"$1."),t=g.call(t,v,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===f.call(r.specifier)?f.call(t):p.call(t)}function j(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=x(o)?String(n.arg):k(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=_(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=E(n.arg,n.width,n.padRight)),s+=n.arg||"",u+=1}return s}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function A(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function I(r){var e,t,n,i;for(t=[],i=0,n=F.exec(r);n;)(e=r.slice(i,F.lastIndex-n[0].length)).length&&t.push(e),t.push(A(n)),i=F.lastIndex,n=F.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function T(r){return"string"==typeof r}function C(r){var e,t,n;if(!T(r))throw new TypeError(C("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=I(r),(t=new Array(arguments.length))[0]=e,n=1;n=0;i--)t[i]=n,n*=r[i];return t}(r)}R=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===Z.call(r))throw new TypeError(C("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===Z.call(t))throw new TypeError(C("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(L.call(r,e)||M.call(r,e)?(n=r.__proto__,r.__proto__=P,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&G&&G.call(r,e,t.get),o&&W&&W.call(r,e,t.set),r},O=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},R(N,"assign",{configurable:!1,enumerable:!1,writable:!1,value:O});function U(r){return Math.abs(r)}function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?"row-major":(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?"row-major":2===t?"column-major":0===r.shape.length?"row-major":null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error("invalid argument. Must provide an ndarray having two or more dimensions.");return i=function(e,t){var n,i,a;return"object"!=typeof(a=e.strides)||null===a?0===(i=e.shape).length?[0]:("string"!=typeof(n=e.order)&&(n="row-major"),N(i,n)):t?r(a):a}(e,!0),t=n[a-2],n[a-2]=n[a-1],n[a-1]=t,t=i[a-2],i[a-2]=i[a-1],i[a-1]=t,new e.constructor(function(r){return r.dtype}(e),function(r){return r.data}(e),n,i,function(r,e){var t,n,i;for(n=r.length,t=0,i=0;i 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar tokens;\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\ttokens = tokenize( str );\n\targs = new Array( arguments.length );\n\targs[ 0 ] = tokens;\n\tfor ( i = 1; i < args.length; i++ ) {\n\t\targs[ i ] = arguments[ i ];\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst= x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","isString","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","spacePad","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":";;AAgCA,SAASA,EAAMC,GACd,IAAIC,EACAC,EACAC,EAIJ,IAFAD,EAAMF,EAAEI,OACRH,EAAM,GACAE,EAAI,EAAGA,EAAID,EAAKC,IACrBF,EAAII,KAAML,EAAGG,IAEd,OAAOF,CACR,CCrBA,IAAIK,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCrF,IAAIA,EAAiBD,OAAOC,eCjB5B,SAASC,EAAUC,GAClB,MAA0B,iBAAVA,CACjB,CCAA,SAASC,EAAOC,GACf,IACIT,EADAF,EAAM,GAEV,IAAME,EAAI,EAAGA,EAAIS,EAAGT,IACnBF,GAAO,IAER,OAAOA,CACR,CAcA,SAASY,EAASC,EAAKC,EAAOC,GAC7B,IAAIC,GAAW,EACXC,EAAMH,EAAQD,EAAIV,OACtB,OAAKc,EAAM,IAnCZ,SAA0BJ,GACzB,MAAoB,MAAbA,EAAK,EACb,CAoCMK,CAAiBL,KACrBG,GAAW,EACXH,EAAMA,EAAIM,OAAQ,IAEnBN,EAAM,EACLA,EAAMH,EAAOO,GACbP,EAAOO,GAAQJ,EACXG,IACJH,EAAM,IAAMA,IAVLA,CAaT,CCpDA,IAAIO,EAAYC,OAAOC,UAAUC,YAC7BC,EAAYH,OAAOC,UAAUG,YAajC,SAASC,EAAeC,GACvB,IAAIC,EACA5B,EACAE,EAEJ,OAASyB,EAAME,WACf,IAAK,IAEJD,EAAO,EACP,MACD,IAAK,IAEJA,EAAO,EACP,MACD,IAAK,IACL,IAAK,IAEJA,EAAO,GACP,MAID,QAECA,EAAO,GAKR,GAFA5B,EAAM2B,EAAMG,IACZ5B,EAAI6B,SAAU/B,EAAK,KACbgC,SAAU9B,GAAM,CACrB,IAAMM,EAAUR,GACf,MAAM,IAAIiC,MAAO,2BAA6BjC,GAE/CE,EAAI,CACJ,CAkCD,OAjCKA,EAAI,IAA2B,MAApByB,EAAME,WAA8B,KAATD,KAC1C1B,EAAI,WAAaA,EAAI,GAEjBA,EAAI,GACRF,IAASE,GAAIgC,SAAUN,GAClBD,EAAMQ,YACVnC,EAAMY,EAASZ,EAAK2B,EAAMQ,UAAWR,EAAMS,WAE5CpC,EAAM,IAAMA,IAEZA,EAAME,EAAEgC,SAAUN,GACZ1B,GAAMyB,EAAMQ,UAENR,EAAMQ,YACjBnC,EAAMY,EAASZ,EAAK2B,EAAMQ,UAAWR,EAAMS,WAF3CpC,EAAM,GAIF2B,EAAMU,OACVrC,EAAM2B,EAAMU,KAAOrC,IAGP,KAAT4B,IACCD,EAAMW,YACVtC,EAAM,KAAOA,GAEdA,EAAQ2B,EAAME,YAAcL,EAAUe,KAAMZ,EAAME,WACjDL,EAAUe,KAAMvC,GAChBoB,EAAUmB,KAAMvC,IAEJ,IAAT4B,GACCD,EAAMW,WAAiC,MAApBtC,EAAIwC,OAAQ,KACnCxC,EAAM,IAAMA,GAGPA,CACR,CC3EA,SAASyC,EAAUhC,GAClB,MAA0B,iBAAVA,CACjB,CCXA,IAAIiC,EAAMC,KAAKD,IACXtB,EAAYC,OAAOC,UAAUC,YAC7BC,EAAYH,OAAOC,UAAUG,YAC7BmB,EAAUvB,OAAOC,UAAUsB,QAK3BC,EAAoB,WACpBC,EAAoB,UACpBC,EAAiB,UACjBC,EAAuB,UACvBC,EAA0B,OAC1BC,EAAqB,QACrBC,EAAqB,gBAazB,SAASC,EAAczB,GACtB,IAAI0B,EACArD,EACAsD,EAAIC,WAAY5B,EAAMG,KAC1B,IAAME,SAAUsB,GAAM,CACrB,IAAM9C,EAAUmB,EAAMG,KACrB,MAAM,IAAIG,MAAO,yCAA2CjC,GAG7DsD,EAAI3B,EAAMG,GACV,CACD,OAASH,EAAME,WACf,IAAK,IACL,IAAK,IACJ7B,EAAMsD,EAAEE,cAAe7B,EAAMQ,WAC7B,MACD,IAAK,IACL,IAAK,IACJnC,EAAMsD,EAAEG,QAAS9B,EAAMQ,WACvB,MACD,IAAK,IACL,IAAK,IACCO,EAAKY,GAAM,OACfD,EAAS1B,EAAMQ,WACD,IACbkB,GAAU,GAEXrD,EAAMsD,EAAEE,cAAeH,IAEvBrD,EAAMsD,EAAEI,YAAa/B,EAAMQ,WAEtBR,EAAMW,YACXtC,EAAM4C,EAAQL,KAAMvC,EAAKmD,EAAoB,OAC7CnD,EAAM4C,EAAQL,KAAMvC,EAAKkD,EAAoB,KAC7ClD,EAAM4C,EAAQL,KAAMvC,EAAKiD,EAAyB,KAEnD,MACD,QACC,MAAM,IAAIhB,MAAO,mCAAqCN,EAAME,WAc7D,OAZA7B,EAAM4C,EAAQL,KAAMvC,EAAK6C,EAAmB,SAC5C7C,EAAM4C,EAAQL,KAAMvC,EAAK8C,EAAmB,SACvCnB,EAAMW,YACVtC,EAAM4C,EAAQL,KAAMvC,EAAK+C,EAAgB,OACzC/C,EAAM4C,EAAQL,KAAMvC,EAAKgD,EAAsB,SAE3CM,GAAK,GAAK3B,EAAMU,OACpBrC,EAAM2B,EAAMU,KAAOrC,GAEpBA,EAAQ2B,EAAME,YAAcL,EAAUe,KAAMZ,EAAME,WACjDL,EAAUe,KAAMvC,GAChBoB,EAAUmB,KAAMvC,EAElB,CC5EA,SAAS2D,EAAQhD,GAChB,IACIT,EADAF,EAAM,GAEV,IAAME,EAAI,EAAGA,EAAIS,EAAGT,IACnBF,GAAO,IAER,OAAOA,CACR,CAcA,SAAS4D,EAAU/C,EAAKC,EAAOC,GAC9B,IAAIE,EAAMH,EAAQD,EAAIV,OACtB,OAAKc,EAAM,EACHJ,EAERA,EAAM,EACLA,EAAM8C,EAAQ1C,GACd0C,EAAQ1C,GAAQJ,CAElB,CC5BA,IAAIgD,EAAexC,OAAOwC,aACtBC,EAAQC,MACRC,EAAUC,MAAMD,QAYpB,SAASE,EAAYvC,GACpB,IAAI3B,EAAM,CAAA,EAMV,OALAA,EAAI6B,UAAYF,EAAME,UACtB7B,EAAImC,eAAkC,IAApBR,EAAMQ,UAAyB,EAAIR,EAAMQ,UAC3DnC,EAAIc,MAAQa,EAAMb,MAClBd,EAAImE,MAAQxC,EAAMwC,OAAS,GAC3BnE,EAAIoE,QAAUzC,EAAMyC,QACbpE,CACR,CAmBA,SAASqE,EAAmBC,GAC3B,IAAIC,EACAJ,EACAxC,EACA6C,EACAC,EACAzE,EACA0E,EACAxE,EACAyE,EAEJ,IAAMX,EAASM,GACd,MAAM,IAAIM,UAAW,8DAAgEN,EAAS,MAI/F,IAFAtE,EAAM,GACN0E,EAAM,EACAxE,EAAI,EAAGA,EAAIoE,EAAOnE,OAAQD,IAE/B,GAAKuC,EADLd,EAAQ2C,EAAQpE,IAEfF,GAAO2B,MACD,CAGN,GAFA4C,OAAgC,IAApB5C,EAAMQ,YAClBR,EAAQuC,EAAYvC,IACRE,UACX,MAAM,IAAI+C,UAAW,oEAAqE1E,EAAG,cAAgByB,EAAQ,MAMtH,IAJKA,EAAMyC,UACVM,EAAM/C,EAAMyC,SAEbD,EAAQxC,EAAMwC,MACRQ,EAAI,EAAGA,EAAIR,EAAMhE,OAAQwE,IAE9B,OADAH,EAAOL,EAAM3B,OAAQmC,IAErB,IAAK,IACJhD,EAAMU,KAAO,IACb,MACD,IAAK,IACJV,EAAMU,KAAO,IACb,MACD,IAAK,IACJV,EAAMS,UAAW,EACjBT,EAAMkD,UAAW,EACjB,MACD,IAAK,IACJlD,EAAMkD,SAAWV,EAAMW,QAAS,KAAQ,EACxC,MACD,IAAK,IACJnD,EAAMW,WAAY,EAClB,MACD,QACC,MAAM,IAAIL,MAAO,iBAAmBuC,GAGtC,GAAqB,MAAhB7C,EAAMb,MAAgB,CAG1B,GAFAa,EAAMb,MAAQiB,SAAUgD,UAAWL,GAAO,IAC1CA,GAAO,EACFZ,EAAOnC,EAAMb,OACjB,MAAM,IAAI8D,UAAW,wCAA0CF,EAAM,6BAA+B/C,EAAMb,MAAQ,MAE9Ga,EAAMb,MAAQ,IAClBa,EAAMS,UAAW,EACjBT,EAAMb,OAASa,EAAMb,MAEtB,CACD,GAAKyD,GACqB,MAApB5C,EAAMQ,UAAoB,CAG9B,GAFAR,EAAMQ,UAAYJ,SAAUgD,UAAWL,GAAO,IAC9CA,GAAO,EACFZ,EAAOnC,EAAMQ,WACjB,MAAM,IAAIyC,UAAW,4CAA8CF,EAAM,6BAA+B/C,EAAMQ,UAAY,MAEtHR,EAAMQ,UAAY,IACtBR,EAAMQ,UAAY,EAClBoC,GAAY,EAEb,CAGF,OADA5C,EAAMG,IAAMiD,UAAWL,GACd/C,EAAME,WACf,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IAEC0C,IACJ5C,EAAMkD,UAAW,GAElBlD,EAAMG,IAAMJ,EAAeC,GAC3B,MACD,IAAK,IAEJA,EAAMqD,SAAW,EAAgBrD,EAAMQ,WAAa,EACpD,MACD,IAAK,IAEJ,IAAM2B,EAAOnC,EAAMG,KAAQ,CAE1B,IADA2C,EAAM1C,SAAUJ,EAAMG,IAAK,KAChB,GAAK2C,EAAM,IACrB,MAAM,IAAIxC,MAAO,kCAAoCN,EAAMG,KAE5DH,EAAMG,IAAQgC,EAAOW,GACpBpD,OAAQM,EAAMG,KACd+B,EAAcY,EACf,CACD,MACD,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IAEEF,IACL5C,EAAMQ,UAAY,GAEnBR,EAAMG,IAAMsB,EAAczB,GAC1B,MACD,QACC,MAAM,IAAIM,MAAO,sBAAwBN,EAAME,WAG3CF,EAAMqD,UAAY,GAAKrD,EAAMG,IAAI3B,OAASwB,EAAMqD,WACpDrD,EAAMG,IAAMH,EAAMG,IAAImD,UAAW,EAAGtD,EAAMqD,WAEtCrD,EAAMkD,SACVlD,EAAMG,IAAMlB,EAASe,EAAMG,IAAKH,EAAMb,OAASa,EAAMQ,UAAWR,EAAMS,UAC3DT,EAAMb,QACjBa,EAAMG,IAAM8B,EAAUjC,EAAMG,IAAKH,EAAMb,MAAOa,EAAMS,WAErDpC,GAAO2B,EAAMG,KAAO,GACpB4C,GAAO,CACP,CAEF,OAAO1E,CACR,CC3LA,IAAIkF,EAAK,6EAYT,SAASC,EAAOC,GACf,IAAIzD,EAAQ,CACXyC,QAAagB,EAAO,GAAQrD,SAAUqD,EAAO,GAAK,SAAO,EACzDjB,MAASiB,EAAO,GAChBtE,MAASsE,EAAO,GAChBjD,UAAaiD,EAAO,GACpBvD,UAAauD,EAAO,IAKrB,MAHoB,MAAfA,EAAO,SAA8B,IAAfA,EAAO,KACjCzD,EAAMQ,UAAY,KAEZR,CACR,CAeA,SAAS0D,EAAgBxE,GACxB,IAAIyE,EACAhB,EACAc,EACAG,EAKJ,IAHAjB,EAAS,GACTiB,EAAO,EACPH,EAAQF,EAAGM,KAAM3E,GACTuE,IACPE,EAAUzE,EAAI4E,MAAOF,EAAML,EAAGQ,UAAYN,EAAO,GAAIjF,SACxCA,QACZmE,EAAOlE,KAAMkF,GAEdhB,EAAOlE,KAAM+E,EAAOC,IACpBG,EAAOL,EAAGQ,UACVN,EAAQF,EAAGM,KAAM3E,GAMlB,OAJAyE,EAAUzE,EAAI4E,MAAOF,IACRpF,QACZmE,EAAOlE,KAAMkF,GAEPhB,CACR,CClDA,SAAS7B,EAAUhC,GAClB,MAA0B,iBAAVA,CACjB,CCUA,SAASkF,EAAQ9E,GAChB,IAAIyD,EACAsB,EACA1F,EAEJ,IAAMuC,EAAU5B,GACf,MAAM,IAAI+D,UAAWe,EAAQ,kEAAmE9E,IAKjG,IAHAyD,EAASuB,EAAUhF,IACnB+E,EAAO,IAAI3B,MAAOc,UAAU5E,SACtB,GAAMmE,EACNpE,EAAI,EAAGA,EAAI0F,EAAKzF,OAAQD,IAC7B0F,EAAM1F,GAAM6E,UAAW7E,GAExB,OAAO4F,EAAYC,MAAO,KAAMH,EACjC,CChCA,ICkBIrF,ECF0CE,EFhB1CuF,EAAiB1F,OAAOgB,UACxB2E,EAAQD,EAAe9D,SACvBgE,EAAeF,EAAeG,iBAC9BC,EAAeJ,EAAeK,iBAC9BC,EAAeN,EAAeO,iBAC9BC,EAAeR,EAAeS,iBGoDlC,SAASC,EAAeC,EAAOC,GAC9B,MAAe,iBAAVA,EAhCN,SAAsBD,GACrB,IAAI3G,EACA6G,EACA3G,EAIJ,IAFAF,EAAM,GACN6G,EAAI,EACE3G,EAAI,EAAGA,EAAIyG,EAAMxG,OAAQD,IAC9BF,EAAII,KAAMyG,GACVA,GAAKF,EAAOzG,GAEb,OAAOF,CACR,CAqBS8G,CAAaH,GA3DtB,SAAmBA,GAClB,IAAII,EACA/G,EACA6G,EACA3G,EAIJ,IAFA6G,EAAQJ,EAAMxG,OACdH,EAAM,GACAE,EAAI,EAAGA,EAAI6G,EAAO7G,IACvBF,EAAII,KAAM,GAGX,IADAyG,EAAI,EACE3G,EAAI6G,EAAM,EAAG7G,GAAK,EAAGA,IAC1BF,EAAKE,GAAM2G,EACXA,GAAKF,EAAOzG,GAEb,OAAOF,CACR,CA4CQgH,CAAUL,EAClB,CFxCCpG,EGdD,WAEC,IAEC,OADAA,EAAgB,CAAE,EAAE,IAAK,CAAA,IAClB,CAGP,CAFC,MAAQ0G,GACT,OAAO,CACP,CACF,CHGKC,GACaC,EDqBlB,SAAyBC,EAAKC,EAAMC,GACnC,IAAIhG,EACAiG,EACAC,EACAC,EAEJ,GAAoB,iBAARL,GAA4B,OAARA,GAAsC,mBAAtBnB,EAAM1D,KAAM6E,GAC3D,MAAM,IAAIxC,UAAWe,EAAQ,mEAAoEyB,IAElG,GAA2B,iBAAfE,GAA0C,OAAfA,GAAoD,mBAA7BrB,EAAM1D,KAAM+E,GACzE,MAAM,IAAI1C,UAAWe,EAAQ,wEAAyE2B,IAyBvG,IAvBAC,EAAa,UAAWD,KAGtBhB,EAAa/D,KAAM6E,EAAKC,IACxBb,EAAajE,KAAM6E,EAAKC,IAGxB/F,EAAY8F,EAAIM,UAChBN,EAAIM,UAAY1B,SAGToB,EAAKC,GACZD,EAAKC,GAASC,EAAW7G,MAGzB2G,EAAIM,UAAYpG,GAEhB8F,EAAKC,GAASC,EAAW7G,OAG3B+G,EAAW,QAASF,EACpBG,EAAW,QAASH,EAEfC,IAAcC,GAAUC,GAC5B,MAAM,IAAIxF,MAAO,wHASlB,OANKuF,GAAUtB,GACdA,EAAa3D,KAAM6E,EAAKC,EAAMC,EAAWK,KAErCF,GAAUrB,GACdA,EAAa7D,KAAM6E,EAAKC,EAAMC,EAAWM,KAEnCR,CACR,EEvE8C3G,EG0C9C,SAAwBkG,EAAOC,EAAO5G,GACrC,MAAe,iBAAV4G,EApCN,SAAsBD,EAAO3G,GAC5B,IAAI6G,EACA3G,EAGJ,IADA2G,EAAI,EACE3G,EAAI,EAAGA,EAAIyG,EAAMxG,OAAQD,IAC9BF,EAAKE,GAAM2G,EACXA,GAAKF,EAAOzG,GAEb,OAAOF,CACR,CA2BS8G,CAAaH,EAAO3G,GA3D7B,SAAmB2G,EAAO3G,GACzB,IACI6G,EACA3G,EAIJ,IADA2G,EAAI,EACE3G,EAFEyG,EAAMxG,OAEE,EAAGD,GAAK,EAAGA,IAC1BF,EAAKE,GAAM2G,EACXA,GAAKF,EAAOzG,GAEb,OAAOF,CACR,CAiDQgH,CAAUL,EAAO3G,EACzB,EJnCeO,EKbfF,EAAA,SJE4B,CAC1BwH,cAAgB,EAChBC,YAAc,EACdC,UAAY,EACZtH,MAASA,IKFX,SAASiC,EAAK3C,GACb,OAAO4C,KAAKD,IAAK3C,EAClB,CCDA,SAAS6G,EAAO7G,GACf,IAAIiI,EACAC,EAGJ,MAAkB,iBADlBA,EAAIlI,EAAE6G,OAEEqB,EAIW,iBADnBD,EAAKjI,EAAEmI,UAC+B,OAAPF,EAhChB,aAmCfC,ECdD,SAAwBC,GACvB,IAAIC,EACApB,EACAqB,EACAC,EACAC,EACApI,EAGJ,GAAe,KADf6G,EAAQmB,EAAQ/H,QAEf,OAAO,EAMR,IAJAgI,GAAS,EACTC,GAAM,EAENC,EAAK3F,EAAKwF,EAAS,IACbhI,EAAI,EAAGA,EAAI6G,EAAO7G,IAAM,CAO7B,GANAoI,EAAK5F,EAAKwF,EAAShI,IACdiI,GAAUG,EAAKD,EACnBF,GAAS,EACEC,GAAOE,EAAKD,IACvBD,GAAM,IAEFA,IAAOD,EAGX,OAAO,EAFPE,EAAKC,CAIN,CACD,OAAKF,GAAOD,EACJ,EAEHC,EACG,EAED,CACR,CDtBKG,CAAeP,GACR,IAANC,GAAiB,IAANA,EApCD,YAuCJ,IAANA,EAtCa,eA0CM,IAAnBlI,EAAE4G,MAAMxG,OA3CE,YA+CR,KACR,CEfA,SAASqI,EAAWzI,GACnB,IAAI0I,EACAC,EACAV,EACAW,EAIJ,GAFAD,EC1BD,SAAgB3I,EAAGD,GAClB,IAAI4I,EAAK3I,EAAE4G,MACX,OAAK7G,EACG8I,EAAaF,GAEdA,CACR,CDoBMG,CAAU9I,GAAG,IAClB4I,EAAID,EAAGvI,QACE,EACR,MAAM,IAAI8B,MAAO,4EAalB,OAXA+F,EEzBD,SAAkBjI,EAAGD,GACpB,IAAIgJ,EACAJ,EACAV,EAGJ,MAAmB,iBADnBA,EAAIjI,EAAEmI,UACgC,OAAPF,EAEX,KADnBU,EAAK3I,EAAE4G,OACCxG,OACA,CAAE,IAGU,iBADpB2I,EAAM/I,EAAE6G,SAEPkC,EA/Ba,aAiCPpC,EAAegC,EAAII,IAEtBhJ,EACG8I,EAAaZ,GAEdA,CACR,CFIMe,CAAYhJ,GAAG,GAEpB0I,EAAMC,EAAIC,EAAE,GACZD,EAAIC,EAAE,GAAMD,EAAIC,EAAE,GAClBD,EAAIC,EAAE,GAAMF,EAEZA,EAAMT,EAAIW,EAAE,GACZX,EAAIW,EAAE,GAAMX,EAAIW,EAAE,GAClBX,EAAIW,EAAE,GAAMF,EAGL,IAAI1I,EAAEiJ,YG5Cd,SAAgBjJ,GACf,OAAOA,EAAEkJ,KACV,CH0C2BC,CAAUnJ,GI5CrC,SAAeA,GACd,OAAOA,EAAEoJ,IACV,CJ0C0CC,CAASrJ,GAAK2I,EAAIV,EK9C5D,SAAyBrB,EAAOuB,GAC/B,IAAImB,EACAtC,EACA7G,EAIJ,IAFA6G,EAAQJ,EAAMxG,OACdkJ,EAAS,EACHnJ,EAAI,EAAGA,EAAI6G,EAAO7G,IAClBgI,EAAShI,GAAM,IAEnBmJ,GAAUnB,EAAShI,IAAQyG,EAAOzG,GAAI,IAGxC,OAAOmJ,CACR,CLgCgEC,CAAgBZ,EAAIV,GAAMuB,EAAUxJ,GACpG"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 05e2534..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 84fc4505d01c3947692e6c44b7566548102253a3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 02:25:37 +0000 Subject: [PATCH 089/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 --- .github/workflows/publish.yml | 255 - .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 - benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 89 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 --- 54 files changed, 6194 insertions(+), 6047 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index 9bc6526..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA corresponding to v3.1.3 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 85ec0a5bfacedb2f7af6d272da3c601222e11961 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:08:42 +0000 Subject: [PATCH 090/131] Update README.md for Deno bundle v0.2.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e232879..6a129d9 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.0-deno/mod.js'; ``` #### transpose( x ) @@ -112,7 +112,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.0-deno/mod.js'; function print( arr, name ) { var str; From 3d4eb3d2d811ca957cb64cb52b51b1cbc148f4b2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:08:43 +0000 Subject: [PATCH 091/131] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a129d9..297e397 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +``` +The previous example will load the latest bundled code from the deno branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/ndarray-base-transpose/tags). For example, + ```javascript import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.0-deno/mod.js'; ``` @@ -112,7 +117,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.0-deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; function print( arr, name ) { var str; From 348cfd0de2db2edb2fcbbb846b5d94f5d2214c44 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 18:52:23 +0000 Subject: [PATCH 092/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 67fe077..0f88a1c 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.1", "@stdlib/ndarray-base-strides": "^0.2.1", "@stdlib/ndarray-base-strides2offset": "^0.2.1", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.2.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From e1078fb617ac224263afc9955d7f9b8cf168d69e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 18:53:07 +0000 Subject: [PATCH 093/131] Remove files --- mod.d.ts | 394 ---- mod.js | 4 - mod.js.map | 1 - stats.html | 6177 ---------------------------------------------------- 4 files changed, 6576 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 7751311..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=g.call(t,y,"$1e"),t=g.call(t,m,"e"),t=g.call(t,b,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=g.call(t,d,"e+0$1"),t=g.call(t,h,"e-0$1"),r.alternate&&(t=g.call(t,w,"$1."),t=g.call(t,v,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===f.call(r.specifier)?f.call(t):p.call(t)}function j(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=x(o)?String(n.arg):k(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=_(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=E(n.arg,n.width,n.padRight)),s+=n.arg||"",l+=1}return s}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function I(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function T(r){var e,t,n,i;for(t=[],i=0,n=F.exec(r);n;)(e=r.slice(i,F.lastIndex-n[0].length)).length&&t.push(e),t.push(I(n)),i=F.lastIndex,n=F.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function A(r){return"string"==typeof r}function C(r){var e,t;if(!A(r))throw new TypeError(C("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[T(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}R=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===Z.call(r))throw new TypeError(C("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===Z.call(t))throw new TypeError(C("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(L.call(r,e)||M.call(r,e)?(n=r.__proto__,r.__proto__=P,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&G&&G.call(r,e,t.get),o&&W&&W.call(r,e,t.set),r},O=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},R(N,"assign",{configurable:!1,enumerable:!1,writable:!1,value:O});function U(r){return Math.abs(r)}function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?"row-major":(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?"row-major":2===t?"column-major":0===r.shape.length?"row-major":null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error("invalid argument. Must provide an ndarray having two or more dimensions.");return i=function(e,t){var n,i,a;return"object"!=typeof(a=e.strides)||null===a?0===(i=e.shape).length?[0]:("string"!=typeof(n=e.order)&&(n="row-major"),N(i,n)):t?r(a):a}(e,!0),t=n[a-2],n[a-2]=n[a-1],n[a-1]=t,t=i[a-2],i[a-2]=i[a-1],i[a-1]=t,new e.constructor(function(r){return r.dtype}(e),function(r){return r.data}(e),n,i,function(r,e){var t,n,i;for(n=r.length,t=0,i=0;i 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","isString","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","spacePad","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 239bfcc..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a7df17b4bc2e8c4a54ae7ead6e2a31ae2f2bd06c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 18:53:31 +0000 Subject: [PATCH 094/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 54 files changed, 4859 insertions(+), 6042 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 66ecda626e6d9943a9f1655a22da6a30981d2df8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 18:54:54 +0000 Subject: [PATCH 095/131] Update README.md for Deno bundle v0.2.1 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef54d51..2669fd9 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.1-deno/mod.js'; ``` #### transpose( x ) @@ -112,7 +112,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.1-deno/mod.js'; function print( arr, name ) { var str; From a1cf3f0b45742fe71de0c40c462aa2d4ce5cd55b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 18:54:55 +0000 Subject: [PATCH 096/131] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2669fd9..09e0b5b 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +``` +The previous example will load the latest bundled code from the deno branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/ndarray-base-transpose/tags). For example, + ```javascript import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.1-deno/mod.js'; ``` @@ -112,7 +117,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.1-deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; function print( arr, name ) { var str; From 86d4068fe6e717a8dd7f7d0006037b5af7c046ab Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 07:44:44 +0000 Subject: [PATCH 097/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 7b27559..af0ea3f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.1", "@stdlib/ndarray-base-strides": "^0.2.1", "@stdlib/ndarray-base-strides2offset": "^0.2.1", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.2.1", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f2e5549f92bd4fac08a57ce09469367738cec78f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 13:23:59 +0000 Subject: [PATCH 098/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index c8e1515..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=j(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),s+=n.arg||"",l+=1}return s}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",N="column-major";function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?N:0===r.shape.length?M:null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4951702..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ff2199cf9c03b640055de542167780bc06b5d0ba Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 13:24:31 +0000 Subject: [PATCH 099/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 55 files changed, 4859 insertions(+), 6044 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 2997fb8..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T05:35:38.525Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 9106b5d..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA corresponding to v2.0.0 - uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From e5d914d7875817a54c87ee06a1d667be2d8d8745 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 07:03:47 +0000 Subject: [PATCH 100/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 7b27559..af0ea3f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.1", "@stdlib/ndarray-base-strides": "^0.2.1", "@stdlib/ndarray-base-strides2offset": "^0.2.1", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.2.1", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ef36307f7e3a469352a03094f41dd1b46b0b3b01 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 12:19:32 +0000 Subject: [PATCH 101/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index c8e1515..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=j(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),s+=n.arg||"",l+=1}return s}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",N="column-major";function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?N:0===r.shape.length?M:null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4951702..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 332136909f3ae7f2c3eabd406012bbb169b64a47 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 12:19:50 +0000 Subject: [PATCH 102/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 132 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 55 files changed, 4859 insertions(+), 6047 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 8703cb7..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T04:54:33.546Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From fb39a000abc1a57dc15d2133122997827881c217 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 03:20:09 +0000 Subject: [PATCH 103/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 7b27559..af0ea3f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.1", "@stdlib/ndarray-base-strides": "^0.2.1", "@stdlib/ndarray-base-strides2offset": "^0.2.1", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/array-complex128": "^0.2.1", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8ff285ac83298a2c7ff122be179ace797ec2ac47 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 08:44:21 +0000 Subject: [PATCH 104/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index c8e1515..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=j(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),s+=n.arg||"",l+=1}return s}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",N="column-major";function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?N:0===r.shape.length?M:null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4951702..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a164042d5a691f0170f2921bc936213f59932d70 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 08:44:46 +0000 Subject: [PATCH 105/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 797 ---- .github/workflows/publish.yml | 249 -- .github/workflows/test.yml | 100 - .github/workflows/test_bundles.yml | 189 - .github/workflows/test_coverage.yml | 134 - .github/workflows/test_install.yml | 86 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 54 files changed, 4859 insertions(+), 6048 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index ec90164..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,797 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 74585ca..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-real' ); -var imag = require( '@stdlib/complex-imag' ); -var realf = require( '@stdlib/complex-realf' ); -var imagf = require( '@stdlib/complex-imagf' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From df939360f9dccf2ac66f4960fcccdb5cf73a57e9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:21:12 +0000 Subject: [PATCH 106/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index acb6c15..aa389a3 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.1", "@stdlib/ndarray-base-strides": "^0.2.1", "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.2.1", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 455693fea5ba5721b08a156af48e4d759163ad71 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:24:32 +0000 Subject: [PATCH 107/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index c8e1515..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=j(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),s+=n.arg||"",l+=1}return s}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",N="column-major";function X(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?N:0===r.shape.length?M:null)}function z(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e');\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isnan = isNaN; // NOTE: We use the global `isNaN` function here instead of `@stdlib/math/base/assert/is-nan` to avoid circular dependencies.\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ?\n\t\t\t\t\t\tString( token.arg ) :\n\t\t\t\t\t\tfromCharCode( num );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isnan","isNaN","isArray","Array","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4951702..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2e3d99dc062ae0ef61404070df430cb0cfcc93f5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:24:58 +0000 Subject: [PATCH 108/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 165 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 54 files changed, 4859 insertions(+), 6221 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index db04011..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 36b438ff05c4aaac181322aeb7f0dc87219fb701 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:26:53 +0000 Subject: [PATCH 109/131] Update README.md for Deno bundle v0.2.2 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd34723..e5e80a8 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.2-deno/mod.js'; ``` #### transpose( x ) @@ -112,7 +112,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.2-deno/mod.js'; function print( arr, name ) { var str; From 9ca9ca7cdf2edfa5abb782c6f117849ed322960b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:26:54 +0000 Subject: [PATCH 110/131] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e5e80a8..e1f04f9 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; +``` +The previous example will load the latest bundled code from the deno branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/ndarray-base-transpose/tags). For example, + ```javascript import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.2-deno/mod.js'; ``` @@ -112,7 +117,7 @@ bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); import Float64Array from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-float64@deno/mod.js'; import ndarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-ctor@deno/mod.js'; import rpad from 'https://cdn.jsdelivr.net/gh/stdlib-js/string-right-pad@deno/mod.js'; -import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@v0.2.2-deno/mod.js'; +import transpose from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-transpose@deno/mod.js'; function print( arr, name ) { var str; From 1ee9c26926489e098f90ba34f77dd7070aebff73 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 07:50:28 +0000 Subject: [PATCH 111/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 418886b..1b0cb97 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.2", "@stdlib/ndarray-base-strides": "^0.2.2", "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/types": "^0.3.2" + "@stdlib/types": "^0.3.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d8d0be9fb83922eab31bef3676eb1f3fe86b1c9d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 12:42:28 +0000 Subject: [PATCH 112/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8951997..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=k(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),c+=n.arg||"",l+=1}return c}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",X="column-major";function z(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?X:0===r.shape.length?M:null)}function q(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index af4783c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 2d75115bca0a3f5e7efa4d11b2b3c3315f1065ea Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 12:43:10 +0000 Subject: [PATCH 113/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 98 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 55 files changed, 4859 insertions(+), 6155 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 2d308bb..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T05:45:27.618Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index db04011..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 907fdaf4e12718a50e78014d15aa27bf60f822b5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 08:14:03 +0000 Subject: [PATCH 114/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index ba723d2..fe26dab 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.2", "@stdlib/ndarray-base-strides": "^0.2.2", "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 728d3e4aae0824939cd38ffdffb2ff35bf391067 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 12:39:31 +0000 Subject: [PATCH 115/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8951997..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=k(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),c+=n.arg||"",l+=1}return c}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",X="column-major";function z(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?X:0===r.shape.length?M:null)}function q(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index af4783c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b725c5934fe7cb101f56b239164477d29572a461 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 12:39:50 +0000 Subject: [PATCH 116/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 164 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 55 files changed, 4859 insertions(+), 6221 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 642b9ea..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T06:11:33.447Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index db04011..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 58972894bd3b587f57c2344997d9ba35bdd32291 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 28 Sep 2024 18:16:11 +0000 Subject: [PATCH 117/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index ba723d2..fe26dab 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.2", "@stdlib/ndarray-base-strides": "^0.2.2", "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d556b4862081f93f1b9f9621cd3eb4de29a19f5e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 28 Sep 2024 18:19:34 +0000 Subject: [PATCH 118/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 8f3d4d3..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray, DataType } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8951997..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=k(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),c+=n.arg||"",l+=1}return c}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",X="column-major";function z(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?X:0===r.shape.length?M:null)}function q(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index af4783c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f5b33d216694626be9bd0d58a396c633c940f08f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 28 Sep 2024 18:20:09 +0000 Subject: [PATCH 119/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 208 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 54 files changed, 4859 insertions(+), 6264 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index db04011..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 7001f730484ad6dc62b8ab855abc388f8eae7936 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 08:30:36 +0000 Subject: [PATCH 120/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index ba723d2..fe26dab 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.2", "@stdlib/ndarray-base-strides": "^0.2.2", "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 68b013bc72956e1b09bc31621e945706319776b9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 13:11:21 +0000 Subject: [PATCH 121/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 91b5415..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8951997..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=k(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),c+=n.arg||"",l+=1}return c}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",X="column-major";function z(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?X:0===r.shape.length?M:null)}function q(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index af4783c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 48884d4511495d916fb1c88a6a8ce3a87a3b0200 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 13:11:45 +0000 Subject: [PATCH 122/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 208 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 55 files changed, 4859 insertions(+), 6265 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index c0cfac5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T06:23:47.690Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index db04011..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 9aad1c4c403776698988a397fa2951a34ffccd7e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 08:18:23 +0000 Subject: [PATCH 123/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index ba723d2..fe26dab 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.2", "@stdlib/ndarray-base-strides": "^0.2.2", "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/types": "^0.4.1" + "@stdlib/types": "^0.4.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1d725bf10a8e9058df2a0ed2f9018690a1610c7a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 12:14:22 +0000 Subject: [PATCH 124/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 91b5415..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8951997..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=k(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),c+=n.arg||"",l+=1}return c}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",X="column-major";function z(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?X:0===r.shape.length?M:null)}function q(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index af4783c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From b561af357213f863cbd871aa0c51e9b15c4d9072 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 12:14:43 +0000 Subject: [PATCH 125/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 208 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 55 files changed, 4859 insertions(+), 6265 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index a316799..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T06:26:52.783Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index db04011..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 6c04a294c15ea46e9b1fac7268fb429e2dc334e3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 08:33:58 +0000 Subject: [PATCH 126/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 040fff6..2748b58 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.2", "@stdlib/ndarray-base-strides": "^0.2.2", "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f18cee8dc52834bd231e37652f8df668f33cd56b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 12:38:57 +0000 Subject: [PATCH 127/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 91b5415..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8951997..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=k(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),c+=n.arg||"",l+=1}return c}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",X="column-major";function z(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?X:0===r.shape.length?M:null)}function q(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index af4783c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From dc68a535aa1839957a637ee9042a151ff528519c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 12:39:30 +0000 Subject: [PATCH 128/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 208 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 56 files changed, 4859 insertions(+), 6370 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index aa37424..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T06:36:23.756Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index db04011..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); From 3cd3ec4e45b45277e13e3ade406b06ba2f69c34c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 02:12:36 +0000 Subject: [PATCH 129/131] Transform error messages --- lib/main.js | 7 ++++--- package.json | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/main.js b/lib/main.js index 415aff4..0c101d3 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,16 +18,18 @@ 'use strict'; +var format = require('@stdlib/error-tools-fmtprodmsg'); + // MODULES // var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); + var getDType = require( '@stdlib/ndarray-base-dtype' ); var getShape = require( '@stdlib/ndarray-base-shape' ); var getStrides = require( '@stdlib/ndarray-base-strides' ); var getOrder = require( '@stdlib/ndarray-base-order' ); var getData = require( '@stdlib/ndarray-base-data-buffer' ); - // MAIN // /** @@ -67,7 +69,7 @@ function transpose( x ) { sh = getShape( x, true ); N = sh.length; if ( N < 2 ) { - throw new Error( 'invalid argument. Must provide an ndarray having two or more dimensions.' ); + throw new Error( format('0jb0c') ); } st = getStrides( x, true ); @@ -83,7 +85,6 @@ function transpose( x ) { return new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len } - // EXPORTS // module.exports = transpose; diff --git a/package.json b/package.json index 040fff6..2748b58 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "@stdlib/ndarray-base-shape": "^0.2.2", "@stdlib/ndarray-base-strides": "^0.2.2", "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/types": "^0.4.3" + "@stdlib/types": "^0.4.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/array-complex128": "^0.3.0", @@ -108,4 +109,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ae46043bf12e9ebc74aaca01b45fdb98adba832b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 02:31:43 +0000 Subject: [PATCH 130/131] Remove files --- mod.d.ts | 394 ----- mod.js | 4 - mod.js.map | 1 - stats.html | 4842 ---------------------------------------------------- 4 files changed, 5241 deletions(-) delete mode 100644 mod.d.ts delete mode 100644 mod.js delete mode 100644 mod.js.map delete mode 100644 stats.html diff --git a/mod.d.ts b/mod.d.ts deleted file mode 100644 index 91b5415..0000000 --- a/mod.d.ts +++ /dev/null @@ -1,394 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2022 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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { ndarray, float64ndarray, float32ndarray, int32ndarray, int16ndarray, int8ndarray, uint32ndarray, uint16ndarray, uint8ndarray, uint8cndarray, complex128ndarray, complex64ndarray } from '@stdlib/types/ndarray'; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float64' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float64ndarray ): float64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'float32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: float32ndarray ): float32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex128Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex128ndarray ): complex128ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var ndarray = require( '@stdlib/ndarray-ctor' ); -* -* var buf = new Complex64Array( [ 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 ] ); -* var x = ndarray( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: complex64ndarray ): complex64ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int32ndarray ): int32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int16ndarray ): int16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'int8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: int8ndarray ): int8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint32' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint32ndarray ): uint32ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint16' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint16ndarray ): uint16ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8ndarray ): uint8ndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'uint8c' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: uint8cndarray ): uint8cndarray; - -/** -* Transposes a matrix (or a stack of matrices). -* -* @param x - input array -* @returns ndarray view -* -* @example -* var array = require( '@stdlib/ndarray-array' ); -* -* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], { -* 'dtype': 'generic' -* }); -* // returns -* -* var sh = x.shape; -* // returns [ 2, 3 ] -* -* var y = transpose( x ); -* // returns -* -* sh = y.shape; -* // returns [ 3, 2 ] -* -* var bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) ); -* // returns true -* -* bool = ( x.data === y.data ); -* // returns true -*/ -declare function transpose( x: ndarray ): ndarray; - - -// EXPORTS // - -export = transpose; diff --git a/mod.js b/mod.js deleted file mode 100644 index 8951997..0000000 --- a/mod.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -function r(r){var e,t,n;for(t=r.length,e=[],n=0;n0&&(e-=1),t=i.toExponential(e)):t=i.toPrecision(r.precision),r.alternate||(t=f.call(t,m,"$1e"),t=f.call(t,b,"e"),t=f.call(t,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return t=f.call(t,g,"e+0$1"),t=f.call(t,h,"e-0$1"),r.alternate&&(t=f.call(t,d,"$1."),t=f.call(t,w,"$1.e")),i>=0&&r.sign&&(t=r.sign+t),t=r.specifier===u.call(r.specifier)?u.call(t):p.call(t)}function _(r){var e,t="";for(e=0;e127)throw new Error("invalid character code. Value: "+n.arg);n.arg=k(o)?String(n.arg):E(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":e||(n.precision=6),n.arg=y(n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=a(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=(f=n.arg,g=n.width,h=n.padRight,d=void 0,(d=g-f.length)<0?f:f=h?f+_(d):_(d)+f)),c+=n.arg||"",l+=1}return c}var V=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function $(r){var e={mapping:r[1]?parseInt(r[1],10):void 0,flags:r[2],width:r[3],precision:r[5],specifier:r[6]};return"."===r[4]&&void 0===r[5]&&(e.precision="1"),e}function F(r){var e,t,n,i;for(t=[],i=0,n=V.exec(r);n;)(e=r.slice(i,V.lastIndex-n[0].length)).length&&t.push(e),t.push($(n)),i=V.lastIndex,n=V.exec(r);return(e=r.slice(i)).length&&t.push(e),t}function I(r){var e,t;if("string"!=typeof r)throw new TypeError(I("invalid argument. First argument must be a string. Value: `%s`.",r));for(e=[F(r)],t=1;t=0;i--)t[i]=n,n*=r[i];return t}(r)}C=function(){try{return e({},"x",{}),!0}catch(r){return!1}}()?t:function(r,e,t){var n,i,a,o;if("object"!=typeof r||null===r||"[object Array]"===R.call(r))throw new TypeError(I("invalid argument. First argument must be an object. Value: `%s`.",r));if("object"!=typeof t||null===t||"[object Array]"===R.call(t))throw new TypeError(I("invalid argument. Property descriptor must be an object. Value: `%s`.",t));if((i="value"in t)&&(Z.call(r,e)||G.call(r,e)?(n=r.__proto__,r.__proto__=A,delete r[e],r[e]=t.value,r.__proto__=n):r[e]=t.value),a="get"in t,o="set"in t,i&&(a||o))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return a&&O&&O.call(r,e,t.get),o&&P&&P.call(r,e,t.set),r},T=function(r,e,t){return"column-major"===e?function(r,e){var t,n;for(t=1,n=0;n=0;n--)e[n]=t,t*=r[n];return e}(r,t)},C(W,"assign",{configurable:!1,enumerable:!1,writable:!1,value:T});var L="row-major";function U(r){return Math.abs(r)}var M="row-major",X="column-major";function z(r){var e,t;return"string"==typeof(t=r.order)?t:"object"!=typeof(e=r.strides)||null===e?M:(t=function(r){var e,t,n,i,a,o;if(0===(t=r.length))return 0;for(e=!0,n=!0,i=U(r[0]),o=1;oi&&(n=!1),!n&&!e)return 0;i=a}return n&&e?3:n?1:2}(e),1===t||3===t?M:2===t?X:0===r.shape.length?M:null)}function q(e){var t,n,i,a;if(n=function(e,t){var n=e.shape;return t?r(n):n}(e,!0),(a=n.length)<2)throw new Error(function(){var r,e=arguments,t="https://stdlib.io/e/"+e[0]+"?";for(r=1;r 0 ) {\n\t\t\t\tdigits -= 1;\n\t\t\t}\n\t\t\tout = f.toExponential( digits );\n\t\t} else {\n\t\t\tout = f.toPrecision( token.precision );\n\t\t}\n\t\tif ( !token.alternate ) {\n\t\t\tout = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' );\n\t\t\tout = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' );\n\t\t\tout = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' );\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tthrow new Error( 'invalid double notation. Value: ' + token.specifier );\n\t}\n\tout = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' );\n\tout = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' );\n\tif ( token.alternate ) {\n\t\tout = replace.call( out, RE_ONLY_DIGITS, '$1.' );\n\t\tout = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' );\n\t}\n\tif ( f >= 0 && token.sign ) {\n\t\tout = token.sign + out;\n\t}\n\tout = ( token.specifier === uppercase.call( token.specifier ) ) ?\n\t\tuppercase.call( out ) :\n\t\tlowercase.call( out );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatDouble;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// FUNCTIONS //\n\n/**\n* Returns `n` spaces.\n*\n* @private\n* @param {number} n - number of spaces\n* @returns {string} string of spaces\n*/\nfunction spaces( n ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < n; i++ ) {\n\t\tout += ' ';\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Pads a token with spaces to the specified width.\n*\n* @private\n* @param {string} str - token argument\n* @param {number} width - token width\n* @param {boolean} [right=false] - boolean indicating whether to pad to the right\n* @returns {string} padded token argument\n*/\nfunction spacePad( str, width, right ) {\n\tvar pad = width - str.length;\n\tif ( pad < 0 ) {\n\t\treturn str;\n\t}\n\tstr = ( right ) ?\n\t\tstr + spaces( pad ) :\n\t\tspaces( pad ) + str;\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default spacePad;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport formatInteger from './format_integer.js';\nimport isString from './is_string.js';\nimport formatDouble from './format_double.js';\nimport spacePad from './space_pad.js';\nimport zeroPad from './zero_pad.js';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\nvar isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies.\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating whether a value is `NaN`.\n*\n* @private\n* @param {*} value - input value\n* @returns {boolean} boolean indicating whether a value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 4 );\n* // returns false\n*/\nfunction isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies\n\treturn ( value !== value );\n}\n\n/**\n* Initializes token object with properties of supplied format identifier object or default values if not present.\n*\n* @private\n* @param {Object} token - format identifier object\n* @returns {Object} token object\n*/\nfunction initialize( token ) {\n\tvar out = {};\n\tout.specifier = token.specifier;\n\tout.precision = ( token.precision === void 0 ) ? 1 : token.precision;\n\tout.width = token.width;\n\tout.flags = token.flags || '';\n\tout.mapping = token.mapping;\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates string from a token array by interpolating values.\n*\n* @param {Array} tokens - string parts and format identifier objects\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be an array\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var tokens = [ 'beep ', { 'specifier': 's' } ];\n* var out = formatInterpolate( tokens, 'boop' );\n* // returns 'beep boop'\n*/\nfunction formatInterpolate( tokens ) {\n\tvar hasPeriod;\n\tvar flags;\n\tvar token;\n\tvar flag;\n\tvar num;\n\tvar out;\n\tvar pos;\n\tvar i;\n\tvar j;\n\n\tif ( !isArray( tokens ) ) {\n\t\tthrow new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' );\n\t}\n\tout = '';\n\tpos = 1;\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tif ( isString( token ) ) {\n\t\t\tout += token;\n\t\t} else {\n\t\t\thasPeriod = token.precision !== void 0;\n\t\t\ttoken = initialize( token );\n\t\t\tif ( !token.specifier ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' );\n\t\t\t}\n\t\t\tif ( token.mapping ) {\n\t\t\t\tpos = token.mapping;\n\t\t\t}\n\t\t\tflags = token.flags;\n\t\t\tfor ( j = 0; j < flags.length; j++ ) {\n\t\t\t\tflag = flags.charAt( j );\n\t\t\t\tswitch ( flag ) {\n\t\t\t\tcase ' ':\n\t\t\t\t\ttoken.sign = ' ';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '+':\n\t\t\t\t\ttoken.sign = '+';\n\t\t\t\t\tbreak;\n\t\t\t\tcase '-':\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t\tbreak;\n\t\t\t\tcase '0':\n\t\t\t\t\ttoken.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies.\n\t\t\t\t\tbreak;\n\t\t\t\tcase '#':\n\t\t\t\t\ttoken.alternate = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error( 'invalid flag: ' + flag );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( token.width === '*' ) {\n\t\t\t\ttoken.width = parseInt( arguments[ pos ], 10 );\n\t\t\t\tpos += 1;\n\t\t\t\tif ( isnan( token.width ) ) {\n\t\t\t\t\tthrow new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' );\n\t\t\t\t}\n\t\t\t\tif ( token.width < 0 ) {\n\t\t\t\t\ttoken.padRight = true;\n\t\t\t\t\ttoken.width = -token.width;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( hasPeriod ) {\n\t\t\t\tif ( token.precision === '*' ) {\n\t\t\t\t\ttoken.precision = parseInt( arguments[ pos ], 10 );\n\t\t\t\t\tpos += 1;\n\t\t\t\t\tif ( isnan( token.precision ) ) {\n\t\t\t\t\t\tthrow new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( token.precision < 0 ) {\n\t\t\t\t\t\ttoken.precision = 1;\n\t\t\t\t\t\thasPeriod = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoken.arg = arguments[ pos ];\n\t\t\tswitch ( token.specifier ) {\n\t\t\tcase 'b':\n\t\t\tcase 'o':\n\t\t\tcase 'x':\n\t\t\tcase 'X':\n\t\t\tcase 'd':\n\t\t\tcase 'i':\n\t\t\tcase 'u':\n\t\t\t\t// Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal)\n\t\t\t\tif ( hasPeriod ) {\n\t\t\t\t\ttoken.padZeros = false;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatInteger( token );\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\t// Case: %s (string)\n\t\t\t\ttoken.maxWidth = ( hasPeriod ) ? token.precision : -1;\n\t\t\t\ttoken.arg = String( token.arg );\n\t\t\t\tbreak;\n\t\t\tcase 'c':\n\t\t\t\t// Case: %c (character)\n\t\t\t\tif ( !isnan( token.arg ) ) {\n\t\t\t\t\tnum = parseInt( token.arg, 10 );\n\t\t\t\t\tif ( num < 0 || num > 127 ) {\n\t\t\t\t\t\tthrow new Error( 'invalid character code. Value: ' + token.arg );\n\t\t\t\t\t}\n\t\t\t\t\ttoken.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'e':\n\t\t\tcase 'E':\n\t\t\tcase 'f':\n\t\t\tcase 'F':\n\t\t\tcase 'g':\n\t\t\tcase 'G':\n\t\t\t\t// Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F)\n\t\t\t\tif ( !hasPeriod ) {\n\t\t\t\t\ttoken.precision = 6;\n\t\t\t\t}\n\t\t\t\ttoken.arg = formatDouble( token );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error( 'invalid specifier: ' + token.specifier );\n\t\t\t}\n\t\t\t// Fit argument into field width...\n\t\t\tif ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) {\n\t\t\t\ttoken.arg = token.arg.substring( 0, token.maxWidth );\n\t\t\t}\n\t\t\tif ( token.padZeros ) {\n\t\t\t\ttoken.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len\n\t\t\t} else if ( token.width ) {\n\t\t\t\ttoken.arg = spacePad( token.arg, token.width, token.padRight );\n\t\t\t}\n\t\t\tout += token.arg || '';\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default formatInterpolate;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default formatTokenize;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport interpolate from '@stdlib/string-base-format-interpolate';\nimport tokenize from '@stdlib/string-base-format-tokenize';\nimport isString from './is_string.js';\n\n\n// MAIN //\n\n/**\n* Inserts supplied variable values into a format string.\n*\n* @param {string} str - input string\n* @param {Array} ...args - variable values\n* @throws {TypeError} first argument must be a string\n* @throws {Error} invalid flags\n* @returns {string} formatted string\n*\n* @example\n* var str = format( 'Hello %s!', 'world' );\n* // returns 'Hello world!'\n*\n* @example\n* var str = format( 'Pi: ~%.2f', 3.141592653589793 );\n* // returns 'Pi: ~3.14'\n*/\nfunction format( str ) {\n\tvar args;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\targs = [ tokenize( str ) ];\n\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\targs.push( arguments[ i ] );\n\t}\n\treturn interpolate.apply( null, args );\n}\n\n\n// EXPORTS //\n\nexport default format;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Tests if a value is a string primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a string primitive\n*\n* @example\n* var bool = isString( 'beep' );\n* // returns true\n*\n* @example\n* var bool = isString( new String( 'beep' ) );\n* // returns false\n*/\nfunction isString( value ) {\n\treturn ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies.\n}\n\n\n// EXPORTS //\n\nexport default isString;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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/* eslint-disable no-underscore-dangle, no-proto */\n\n'use strict';\n\n// MODULES //\n\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar objectProtoype = Object.prototype;\nvar toStr = objectProtoype.toString;\nvar defineGetter = objectProtoype.__defineGetter__;\nvar defineSetter = objectProtoype.__defineSetter__;\nvar lookupGetter = objectProtoype.__lookupGetter__;\nvar lookupSetter = objectProtoype.__lookupSetter__;\n\n\n// MAIN //\n\n/**\n* Defines (or modifies) an object property.\n*\n* ## Notes\n*\n* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.\n*\n* @param {Object} obj - object on which to define the property\n* @param {string} prop - property name\n* @param {Object} descriptor - property descriptor\n* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object\n* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties\n* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator\n* @param {*} [descriptor.value] - property value\n* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the property value.\n* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} third argument must be an object\n* @throws {Error} property descriptor cannot have both a value and a setter and/or getter\n* @returns {Object} object with added property\n*\n* @example\n* var obj = {};\n*\n* defineProperty( obj, 'foo', {\n* 'value': 'bar'\n* });\n*\n* var str = obj.foo;\n* // returns 'bar'\n*/\nfunction defineProperty( obj, prop, descriptor ) {\n\tvar prototype;\n\tvar hasValue;\n\tvar hasGet;\n\tvar hasSet;\n\n\tif ( typeof obj !== 'object' || obj === null || toStr.call( obj ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', obj ) );\n\t}\n\tif ( typeof descriptor !== 'object' || descriptor === null || toStr.call( descriptor ) === '[object Array]' ) {\n\t\tthrow new TypeError( format( 'invalid argument. Property descriptor must be an object. Value: `%s`.', descriptor ) );\n\t}\n\thasValue = ( 'value' in descriptor );\n\tif ( hasValue ) {\n\t\tif (\n\t\t\tlookupGetter.call( obj, prop ) ||\n\t\t\tlookupSetter.call( obj, prop )\n\t\t) {\n\t\t\t// Override `__proto__` to avoid touching inherited accessors:\n\t\t\tprototype = obj.__proto__;\n\t\t\tobj.__proto__ = objectProtoype;\n\n\t\t\t// Delete property as existing getters/setters prevent assigning value to specified property:\n\t\t\tdelete obj[ prop ];\n\t\t\tobj[ prop ] = descriptor.value;\n\n\t\t\t// Restore original prototype:\n\t\t\tobj.__proto__ = prototype;\n\t\t} else {\n\t\t\tobj[ prop ] = descriptor.value;\n\t\t}\n\t}\n\thasGet = ( 'get' in descriptor );\n\thasSet = ( 'set' in descriptor );\n\n\tif ( hasValue && ( hasGet || hasSet ) ) {\n\t\tthrow new Error( 'invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.' );\n\t}\n\n\tif ( hasGet && defineGetter ) {\n\t\tdefineGetter.call( obj, prop, descriptor.get );\n\t}\n\tif ( hasSet && defineSetter ) {\n\t\tdefineSetter.call( obj, prop, descriptor.set );\n\t}\n\treturn obj;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Define (or modify) an object property.\n*\n* @module @stdlib/utils-define-property\n*\n* @example\n* import defineProperty from '@stdlib/utils-define-property';\n*\n* var obj = {};\n* defineProperty( obj, 'foo', {\n* 'value': 'bar',\n* 'writable': false,\n* 'configurable': false,\n* 'enumerable': false\n* });\n* obj.foo = 'boop'; // => throws\n*/\n\n// MODULES //\n\nimport hasDefinePropertySupport from './has_define_property_support.js';\nimport builtin from './builtin.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar defineProperty;\nif ( hasDefinePropertySupport() ) {\n\tdefineProperty = builtin;\n} else {\n\tdefineProperty = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default defineProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport defineProperty from '@stdlib/utils-define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-only property.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {*} value - value to set\n*\n* @example\n* var obj = {};\n*\n* setNonEnumerableReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setNonEnumerableReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': false,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadOnly;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction rowmajor( shape ) {\n\tvar ndims;\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tout = [];\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tout.push( 0 );\n\t}\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @returns {Array} array strides\n*/\nfunction columnmajor( shape ) {\n\tvar out;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout.push( s );\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @returns {Array} array strides\n*\n* @example\n* var s = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* s = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape );\n\t}\n\treturn rowmajor( shape );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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\nimport defineProperty from './define_property.js';\n\n\n// MAIN //\n\n/**\n* Tests for `Object.defineProperty` support.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment has `Object.defineProperty` support\n*\n* @example\n* var bool = hasDefinePropertySupport();\n* // returns \n*/\nfunction hasDefinePropertySupport() {\n\t// Test basic support...\n\ttry {\n\t\tdefineProperty( {}, 'x', {} );\n\t\treturn true;\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default hasDefinePropertySupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// FUNCTIONS //\n\n/**\n* Generates a stride array from an array shape (row-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction rowmajor( shape, out ) {\n\tvar ndims;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\ts = 1;\n\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n/**\n* Generates a stride array from an array shape (column-major).\n*\n* @private\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*/\nfunction columnmajor( shape, out ) {\n\tvar s;\n\tvar i;\n\n\ts = 1;\n\tfor ( i = 0; i < shape.length; i++ ) {\n\t\tout[ i ] = s;\n\t\ts *= shape[ i ];\n\t}\n\treturn out;\n}\n\n\n// MAIN //\n\n/**\n* Generates a stride array from an array shape.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {(Array|TypedArray|Object)} out - output object\n* @returns {(Array|TypedArray|Object)} array strides\n*\n* @example\n* var strides = [ 0, 0 ];\n*\n* var out = shape2strides( [ 3, 2 ], 'row-major', strides );\n* // returns [ 2, 1 ]\n*\n* var bool = ( out === strides );\n* // returns true\n*\n* out = shape2strides( [ 3, 2 ], 'column-major', strides );\n* // returns [ 1, 3 ]\n*/\nfunction shape2strides( shape, order, out ) {\n\tif ( order === 'column-major' ) {\n\t\treturn columnmajor( shape, out );\n\t}\n\treturn rowmajor( shape, out );\n}\n\n\n// EXPORTS //\n\nexport default shape2strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Generate a stride array from an array shape.\n*\n* @module @stdlib/ndarray-base-shape2strides\n*\n* @example\n* import shape2strides from '@stdlib/ndarray-base-shape2strides';\n*\n* var strides = shape2strides( [ 3, 2 ], 'row-major' );\n* // returns [ 2, 1 ]\n*\n* strides = shape2strides( [ 3, 2 ], 'column-major' );\n* // returns [ 1, 3 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils-define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport shape2strides from '@stdlib/ndarray-base-shape2strides';\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\n\n\n// MAIN //\n\n/**\n* Returns the strides of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `strides` property\n* @returns {IntegerArray} strides\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = strides( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 9, 3, 1 ]\n*/\nfunction strides( x, copy ) {\n\tvar ord;\n\tvar sh;\n\tvar st;\n\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\tsh = x.shape;\n\t\tif ( sh.length === 0 ) {\n\t\t\treturn [ 0 ];\n\t\t}\n\t\tord = x.order;\n\t\tif ( typeof ord !== 'string' ) {\n\t\t\tord = ROW_MAJOR;\n\t\t}\n\t\treturn shape2strides( sh, ord );\n\t}\n\tif ( copy ) {\n\t\treturn copyIndexed( st );\n\t}\n\treturn st;\n}\n\n\n// EXPORTS //\n\nexport default strides;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport strides2order from '@stdlib/ndarray-base-strides2order';\n\n\n// VARIABLES //\n\nvar ROW_MAJOR = 'row-major';\nvar COLUMN_MAJOR = 'column-major';\n\n\n// MAIN //\n\n/**\n* Returns the layout order of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {(string|null)} layout order\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'order': 'row-major'\n* });\n*\n* var out = order( x );\n* // returns 'row-major'\n*/\nfunction order( x ) {\n\tvar st;\n\tvar o;\n\n\to = x.order;\n\tif ( typeof o === 'string' ) {\n\t\treturn o;\n\t}\n\t// Try to infer the layout order from the strides array...\n\tst = x.strides;\n\tif ( typeof st !== 'object' || st === null ) {\n\t\treturn ROW_MAJOR; // WARNING: default to row-major for ndarray-like objects lacking strides. This may or may not be accurate, and we're defaulting to row-major here based on the belief that row-major is more likely given that, e.g., JavaScript arrays are similar to C arrays (i.e., stored in row-major order).\n\t}\n\to = strides2order( st );\n\tif ( o === 1 || o === 3 ) {\n\t\treturn ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major\n\t}\n\tif ( o === 2 ) {\n\t\treturn COLUMN_MAJOR;\n\t}\n\t// o === 0\n\tif ( x.shape.length === 0 ) {\n\t\treturn ROW_MAJOR; // default to row-major for zero-dimensional ndarrays\n\t}\n\t// Case: mixed strides (e.g., [ 2, 3, 1 ] )\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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\nimport abs from '@stdlib/math-base-special-abs';\n\n\n// MAIN //\n\n/**\n* Determines the order of a multidimensional array based on a provided stride array.\n*\n* @param {IntegerArray} strides - stride array\n* @returns {integer} order\n*\n* @example\n* import strides2order from '@stdlib/ndarray-base-strides2order';\n*\n* var order = strides2order( [ 2, 1 ] );\n* // returns 1\n*\n* order = strides2order( [ 1, 2 ] );\n* // returns 2\n*\n* order = strides2order( [ 1, 1, 1 ] );\n* // returns 3\n*\n* order = strides2order( [ 2, 3, 1 ] );\n* // returns 0\n*/\nfunction strides2order( strides ) {\n\tvar column;\n\tvar ndims;\n\tvar row;\n\tvar s1;\n\tvar s2;\n\tvar i;\n\n\tndims = strides.length;\n\tif ( ndims === 0 ) {\n\t\treturn 0|0; // 'none'\n\t}\n\tcolumn = true;\n\trow = true;\n\n\ts1 = abs( strides[ 0 ] );\n\tfor ( i = 1; i < ndims; i++ ) {\n\t\ts2 = abs( strides[ i ] );\n\t\tif ( column && s2 < s1 ) {\n\t\t\tcolumn = false;\n\t\t} else if ( row && s2 > s1 ) {\n\t\t\trow = false;\n\t\t}\n\t\tif ( row || column ) {\n\t\t\ts1 = s2;\n\t\t} else {\n\t\t\treturn 0|0; // 'none'\n\t\t}\n\t}\n\tif ( row && column ) {\n\t\treturn 3|0; // 'both'\n\t}\n\tif ( row ) {\n\t\treturn 1|0; // 'row-major'\n\t}\n\treturn 2|0; // 'column-major'\n}\n\n\n// EXPORTS //\n\nexport default strides2order;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n// MODULES //\n\nimport strides2offset from '@stdlib/ndarray-base-strides2offset';\n\nimport getDType from '@stdlib/ndarray-base-dtype';\nimport getShape from '@stdlib/ndarray-base-shape';\nimport getStrides from '@stdlib/ndarray-base-strides';\nimport getOrder from '@stdlib/ndarray-base-order';\nimport getData from '@stdlib/ndarray-base-data-buffer';\n\n// MAIN //\n\n/**\n* Transpose a matrix (or a stack of matrices).\n*\n* @param {ndarray} x - input array\n* @throws {Error} must provide an array with two or more dimensions\n* @returns {ndarray} ndarray\n*\n* @example\n* import array from '@stdlib/ndarray-array';\n*\n* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );\n* // returns \n*\n* var sh = x.shape;\n* // returns [ 2, 3 ]\n*\n* var y = transpose( x );\n* // returns \n*\n* sh = y.shape;\n* // returns [ 3, 2 ]\n*\n* var bool = ( x.data === y.data );\n* // returns true\n*\n* bool = ( x.get( 0, 1 ) === y.get( 1, 0 ) );\n* // returns true\n*/\nfunction transpose( x ) {\n\tvar tmp;\n\tvar sh;\n\tvar st;\n\tvar N;\n\n\tsh = getShape( x, true );\n\tN = sh.length;\n\tif ( N < 2 ) {\n\t\tthrow new Error( format('0jb0c') );\n\t}\n\tst = getStrides( x, true );\n\n\ttmp = sh[ N-2 ];\n\tsh[ N-2 ] = sh[ N-1 ];\n\tsh[ N-1 ] = tmp;\n\n\ttmp = st[ N-2 ];\n\tst[ N-2 ] = st[ N-1 ];\n\tst[ N-1 ] = tmp;\n\n\t// FIXME: handling of offset seems incorrect. Should also handle READ-ONLY arrays.\n\treturn new x.constructor( getDType( x ), getData( x ), sh, st, strides2offset( sh, st ), getOrder( x ) ); // eslint-disable-line max-len\n}\n\n// EXPORTS //\n\nexport default transpose;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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\nimport copyIndexed from '@stdlib/array-base-copy-indexed';\n\n\n// MAIN //\n\n/**\n* Returns the shape of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @param {boolean} copy - boolean indicating whether to explicitly copy the value assigned to the input ndarray's `shape` property\n* @returns {NonNegativeIntegerArray} shape\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var out = shape( zeros( [ 3, 3, 3 ] ), false );\n* // returns [ 3, 3, 3 ]\n*/\nfunction shape( x, copy ) {\n\tvar sh = x.shape;\n\tif ( copy ) {\n\t\treturn copyIndexed( sh );\n\t}\n\treturn sh;\n}\n\n\n// EXPORTS //\n\nexport default shape;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\n/**\n* Formats an error message for production.\n*\n* @param {string} code - error code\n* @param {*} ...args - error message arguments\n* @returns {string} formatted error message\n*\n* @example\n* var msg = fmtprodmsg( '3', 'wrong_type' );\n* // returns 'https://stdlib.io/e/3?&arg[]=wrong_type'\n*/\nfunction fmtprodmsg() {\n\tvar a = arguments;\n\tvar c = a[ 0 ];\n\tvar u = 'https://stdlib.io/e/'+c+'?';\n\tvar i;\n\tfor ( i = 1; i < a.length; i++ ) {\n\t\tu += '&arg[]=' + encodeURIComponent( a[ i ] );\n\t}\n\treturn u;\n}\n\n\n// EXPORTS //\n\nexport default fmtprodmsg;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the data type of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {string} data type\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var dt = dtype( x );\n* // returns 'float64'\n*/\nfunction dtype( x ) {\n\treturn x.dtype;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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// MAIN //\n\n/**\n* Returns the underlying data buffer of a provided ndarray.\n*\n* @param {ndarrayLike} x - input ndarray\n* @returns {Collection} underlying data buffer\n*\n* @example\n* import zeros from '@stdlib/ndarray-zeros';\n*\n* var x = zeros( [ 3, 3, 3 ], {\n* 'dtype': 'float64'\n* });\n*\n* var out = data( x );\n* // returns \n*/\nfunction data( x ) {\n\treturn x.data;\n}\n\n\n// EXPORTS //\n\nexport default data;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\n/**\n* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @returns {NonNegativeInteger} offset - offset\n*\n* @example\n* var shape = [ 2, 3, 10 ];\n* var strides = [ 30, -10, 1 ];\n*\n* var offset = strides2offset( shape, strides );\n* // returns 20\n*/\nfunction strides2offset( shape, strides ) {\n\tvar offset;\n\tvar ndims;\n\tvar i;\n\n\tndims = shape.length;\n\toffset = 0;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tif ( strides[ i ] < 0 ) {\n\t\t\t// Note that, since the stride is negative, this operation increments, not decrements, the offset...\n\t\t\toffset -= strides[ i ] * ( shape[ i ]-1 );\n\t\t}\n\t}\n\treturn offset;\n}\n\n\n// EXPORTS //\n\nexport default strides2offset;\n"],"names":["copy","x","out","len","i","length","push","main","Object","defineProperty","isNumber","value","zeros","n","zeroPad","str","width","right","negative","pad","startsWithMinus","substr","lowercase","String","prototype","toLowerCase","uppercase","toUpperCase","formatInteger","token","base","specifier","arg","parseInt","isFinite","Error","toString","precision","padRight","sign","alternate","call","charAt","abs","Math","replace","RE_EXP_POS_DIGITS","RE_EXP_NEG_DIGITS","RE_ONLY_DIGITS","RE_DIGITS_BEFORE_EXP","RE_TRAILING_PERIOD_ZERO","RE_PERIOD_ZERO_EXP","RE_ZERO_BEFORE_EXP","formatDouble","digits","f","parseFloat","toExponential","toFixed","toPrecision","spaces","fromCharCode","isArray","Array","isnan","initialize","flags","mapping","formatInterpolate","tokens","hasPeriod","flag","num","pos","j","TypeError","padZeros","indexOf","arguments","maxWidth","substring","RE","parse","match","formatTokenize","content","prev","exec","slice","lastIndex","format","args","tokenize","interpolate","apply","objectProtoype","toStr","defineGetter","__defineGetter__","defineSetter","__defineSetter__","lookupGetter","__lookupGetter__","lookupSetter","__lookupSetter__","shape2strides","shape","order","s","columnmajor","ndims","rowmajor","err","hasDefinePropertySupport","builtin","obj","prop","descriptor","hasValue","hasGet","hasSet","__proto__","get","set","configurable","enumerable","writable","ROW_MAJOR","COLUMN_MAJOR","st","o","strides","column","row","s1","s2","strides2order","transpose","tmp","sh","N","copyIndexed","getShape","a","u","encodeURIComponent","ord","getStrides","constructor","dtype","getDType","data","getData","offset","strides2offset","getOrder"],"mappings":"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","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,28,29]} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index af4783c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 52c75466111f3dc2b87227d2e2ac21320596a082 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 02:32:12 +0000 Subject: [PATCH 131/131] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 208 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 34 +- SECURITY.md | 5 - benchmark/benchmark.js | 294 -- benchmark/benchmark.size.complex128.js | 95 - benchmark/benchmark.size.complex64.js | 95 - benchmark/benchmark.size.float32.js | 95 - benchmark/benchmark.size.float64.js | 95 - benchmark/benchmark.size.generic.js | 95 - benchmark/benchmark.size.int16.js | 95 - benchmark/benchmark.size.int32.js | 95 - benchmark/benchmark.size.int8.js | 95 - benchmark/benchmark.size.uint16.js | 95 - benchmark/benchmark.size.uint32.js | 95 - benchmark/benchmark.size.uint8.js | 95 - benchmark/benchmark.size.uint8c.js | 95 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 40 - docs/types/test.ts | 60 - examples/index.js | 66 - lib/index.js | 56 - lib/main.js | 90 - docs/types/index.d.ts => mod.d.ts | 2 +- mod.js | 4 + mod.js.map | 1 + package.json | 83 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 905 ---- 56 files changed, 4859 insertions(+), 6370 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/.keepalive delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 benchmark/benchmark.size.complex128.js delete mode 100644 benchmark/benchmark.size.complex64.js delete mode 100644 benchmark/benchmark.size.float32.js delete mode 100644 benchmark/benchmark.size.float64.js delete mode 100644 benchmark/benchmark.size.generic.js delete mode 100644 benchmark/benchmark.size.int16.js delete mode 100644 benchmark/benchmark.size.int32.js delete mode 100644 benchmark/benchmark.size.int8.js delete mode 100644 benchmark/benchmark.size.uint16.js delete mode 100644 benchmark/benchmark.size.uint32.js delete mode 100644 benchmark/benchmark.size.uint8.js delete mode 100644 benchmark/benchmark.size.uint8c.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 lib/index.js delete mode 100644 lib/main.js rename docs/types/index.d.ts => mod.d.ts (98%) create mode 100644 mod.js create mode 100644 mod.js.map create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 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. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index b61de54..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-09T02:05:46.090Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 66c0cc2..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ - - -We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 139acfd..0000000 --- a/.github/workflows/close_pull_requests.yml +++ /dev/null @@ -1,54 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: close_pull_requests - -# Workflow triggers: -on: - pull_request_target: - types: [opened] - -# Workflow jobs: -jobs: - - # Define job to close all pull requests: - run: - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Close pull request - - name: 'Close pull request' - # Pin action to full length commit SHA corresponding to v3.1.2 - uses: superbrothers/close-pull-request@9c18513d320d7b2c7185fb93396d0c664d5d8448 - with: - comment: | - Thank you for submitting a pull request. :raised_hands: - - We greatly appreciate your willingness to submit a contribution. However, we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). - - We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/transpose) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. - - Thank you again, and we look forward to receiving your contribution! :smiley: - - Best, - The stdlib team \ No newline at end of file diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 2984901..0000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 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. -#/ - -# Workflow name: -name: examples - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run the package examples... - examples: - - # Define display name: - name: 'Run examples' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - - # Checkout repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run examples: - - name: 'Run examples' - run: | - npm run examples diff --git a/.github/workflows/npm_downloads.yml b/.github/workflows/npm_downloads.yml deleted file mode 100644 index ee06ed3..0000000 --- a/.github/workflows/npm_downloads.yml +++ /dev/null @@ -1,112 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: npm_downloads - -# Workflow triggers: -on: - # Run this workflow weekly: - schedule: - # cron: ' ' - - cron: '28 4 * * 5' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - # Pin action to full length commit SHA - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - # Pin action to full length commit SHA - uses: distributhor/workflow-webhook@48a40b380ce4593b6a6676528cd005986ae56629 # v3.0.3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index f4575e9..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,794 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 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. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 -r sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - # Pin action to full length commit SHA - uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2 - with: - status: ${{ job.status }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Configure Git: - - name: 'Configure Git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @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 tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index db04011..0000000 --- a/test/test.js +++ /dev/null @@ -1,905 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 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 tape = require( 'tape' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Float32Array = require( '@stdlib/array-float32' ); -var Int32Array = require( '@stdlib/array-int32' ); -var Uint32Array = require( '@stdlib/array-uint32' ); -var Int16Array = require( '@stdlib/array-int16' ); -var Uint16Array = require( '@stdlib/array-uint16' ); -var Int8Array = require( '@stdlib/array-int8' ); -var Uint8Array = require( '@stdlib/array-uint8' ); -var Uint8ClampedArray = require( '@stdlib/array-uint8c' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var realf = require( '@stdlib/complex-float32-real' ); -var imagf = require( '@stdlib/complex-float32-imag' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var base = require( '@stdlib/ndarray-base-ctor' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var array = require( '@stdlib/ndarray-array' ); -var transpose = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof transpose, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an ndarray having fewer than two dimensions', function test( t ) { - var values; - var i; - - values = [ - new ndarray( 'float64', [], [], [ 0 ], 0, 'row-major' ), - new ndarray( 'float64', [ 1 ], [ 1 ], [ 1 ], 0, 'row-major' ) - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - transpose( value ); - }; - } -}); - -tape( 'the function transposes a matrix (dtype=float64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, base, column-major)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float64', buf, [ 2, 3 ], [ 1, 2 ], 0, 'column-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = new base( 'float32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=float32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'float32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'int8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=int8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Int8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'int8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint32', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint32, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint32Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint32' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint16', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint16, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint16Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint16' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8Array( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = new base( 'uint8c', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=uint8c, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Uint8ClampedArray( [ 1, 2, 3, 4, 5, 6 ] ); - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'uint8c' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex128', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex128, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex128' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( real( v1 ), real( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imag( v1 ), imag( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = new base( 'complex64', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=complex64, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0, 6.0 ] ); // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'complex64' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, ndarray ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( realf( v1 ), realf( v2 ), 'returns expected value for ('+j+','+i+')' ); - t.strictEqual( imagf( v1 ), imagf( v2 ), 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function transposes a matrix (dtype=generic, non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = array( buf, { - 'shape': [ 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 2; i++ ) { - for ( j = 0; j < 3; j++ ) { - v1 = x.get( i, j ); - v2 = arr.get( j, i ); - t.strictEqual( v1, v2, 'returns expected value for ('+j+','+i+')' ); - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6 ]; - x = new base( 'generic', buf, [ 4, 2, 3 ], [ 0, 3, 1 ], 0, 'row-major' ); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -}); - -tape( 'the function supports stack of matrices (non-base)', function test( t ) { - var arr; - var buf; - var v1; - var v2; - var x; - var i; - var j; - var k; - - buf = [ 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 ]; // eslint-disable-line max-len - x = array( buf, { - 'shape': [ 4, 2, 3 ], - 'dtype': 'generic' - }); - arr = transpose( x ); - - t.strictEqual( instanceOf( arr, base ), true, 'returns expected value' ); - t.strictEqual( arr.dtype, x.dtype, 'returns expected value' ); - t.deepEqual( arr.shape, [ 4, 3, 2 ], 'returns expected value' ); - t.strictEqual( arr.data, x.data, 'returns expected value' ); - t.strictEqual( arr.order, x.order, 'returns expected value' ); - - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 2; j++ ) { - for ( k = 0; k < 3; k++ ) { - v1 = x.get( i, j, k ); - v2 = arr.get( i, k, j ); - t.strictEqual( v1, v2, 'returns expected value for ('+i+','+k+','+j+')' ); - } - } - } - t.end(); -});