Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Jul 4, 2024
1 parent a954484 commit d0de2b6
Show file tree
Hide file tree
Showing 41 changed files with 2,291 additions and 0 deletions.
89 changes: 89 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,94 @@ This release closes the following issue:

<!-- /.package -->

<section class="package" id="blas-base-operation-side-enum2str-unreleased">

#### [@stdlib/blas/base/operation-side-enum2str](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/operation-side-enum2str)

<details>

<section class="features">

##### Features

- [`04b3803`](https://github.com/stdlib-js/stdlib/commit/04b3803f90e84a700d42da7c1f0117b4676b2040) - add `blas/base/operation-side-*` utilities [(#2499)](https://github.com/stdlib-js/stdlib/pull/2499)

</section>

<!-- /.features -->

</details>

</section>

<!-- /.package -->

<section class="package" id="blas-base-operation-side-resolve-enum-unreleased">

#### [@stdlib/blas/base/operation-side-resolve-enum](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/operation-side-resolve-enum)

<details>

<section class="features">

##### Features

- [`04b3803`](https://github.com/stdlib-js/stdlib/commit/04b3803f90e84a700d42da7c1f0117b4676b2040) - add `blas/base/operation-side-*` utilities [(#2499)](https://github.com/stdlib-js/stdlib/pull/2499)

</section>

<!-- /.features -->

</details>

</section>

<!-- /.package -->

<section class="package" id="blas-base-operation-side-resolve-str-unreleased">

#### [@stdlib/blas/base/operation-side-resolve-str](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/operation-side-resolve-str)

<details>

<section class="features">

##### Features

- [`04b3803`](https://github.com/stdlib-js/stdlib/commit/04b3803f90e84a700d42da7c1f0117b4676b2040) - add `blas/base/operation-side-*` utilities [(#2499)](https://github.com/stdlib-js/stdlib/pull/2499)

</section>

<!-- /.features -->

</details>

</section>

<!-- /.package -->

<section class="package" id="blas-base-operation-side-str2enum-unreleased">

#### [@stdlib/blas/base/operation-side-str2enum](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/operation-side-str2enum)

<details>

<section class="features">

##### Features

- [`04b3803`](https://github.com/stdlib-js/stdlib/commit/04b3803f90e84a700d42da7c1f0117b4676b2040) - add `blas/base/operation-side-*` utilities [(#2499)](https://github.com/stdlib-js/stdlib/pull/2499)

</section>

<!-- /.features -->

</details>

</section>

<!-- /.package -->

<section class="package" id="blas-base-operation-sides-unreleased">

#### [@stdlib/blas/base/operation-sides](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/operation-sides)
Expand Down Expand Up @@ -2213,6 +2301,7 @@ A total of 35 people contributed to this release. Thank you to the following con

<details>

- [`04b3803`](https://github.com/stdlib-js/stdlib/commit/04b3803f90e84a700d42da7c1f0117b4676b2040) - **feat:** add `blas/base/operation-side-*` utilities [(#2499)](https://github.com/stdlib-js/stdlib/pull/2499) _(by Pranav Goswami, Athan Reines)_
- [`a61b40c`](https://github.com/stdlib-js/stdlib/commit/a61b40cedd7518a68efb28372e4bf817aeb5a319) - **feat:** add `blas/base/matrix-triangle-str2enum` and `blas/base/matrix-triangle/enum2str` [(#2495)](https://github.com/stdlib-js/stdlib/pull/2495) _(by Pranav Goswami, Athan Reines)_
- [`bc23559`](https://github.com/stdlib-js/stdlib/commit/bc2355981ffa28082d8e23273887501bd3ba674a) - **feat:** add support for specifying the index offset for `AP` _(by Athan Reines)_
- [`43b84f7`](https://github.com/stdlib-js/stdlib/commit/43b84f7b8614a31ed5985c010572da16b2b5186d) - **refactor:** use utility to resolve an index offset _(by Athan Reines)_
Expand Down
121 changes: 121 additions & 0 deletions base/operation-side-enum2str/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<!--
@license Apache-2.0
Copyright (c) 2024 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# enum2str

> Return the BLAS operation side string associated with a BLAS operation side enumeration constant.
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var enum2str = require( '@stdlib/blas/base/operation-side-enum2str' );
```

#### enum2str( operation )

Returns the BLAS operation side string associated with a BLAS operation side enumeration constant.

```javascript
var str2enum = require( '@stdlib/blas/base/operation-side-str2enum' );

var v = str2enum( 'left' );
// returns <number>

var s = enum2str( v );
// returns 'left'
```

If unable to resolve an operation string, the function returns `null`.

```javascript
var v = enum2str( -999999999 );
// returns null
```

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var str2enum = require( '@stdlib/blas/base/operation-side-str2enum' );
var enum2str = require( '@stdlib/blas/base/operation-side-enum2str' );

var str = enum2str( str2enum( 'left' ) );
// returns 'left'

str = enum2str( str2enum( 'right' ) );
// returns 'right'
```

</section>

<!-- /.examples -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

</section>

<!-- /.links -->
55 changes: 55 additions & 0 deletions base/operation-side-enum2str/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 bench = require( '@stdlib/bench' );
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
var str2enum = require( './../../../base/operation-side-str2enum' );
var pkg = require( './../package.json' ).name;
var enum2str = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
var values;
var out;
var i;

values = [
str2enum( 'left' ),
str2enum( 'right' )
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
out = enum2str( values[ i%values.length ] );
if ( typeof out !== 'string' ) {
b.fail( 'should return a string' );
}
}
b.toc();
if ( !isString( out ) ) {
b.fail( 'should return a string' );
}
b.pass( 'benchmark finished' );
b.end();
});
23 changes: 23 additions & 0 deletions base/operation-side-enum2str/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

{{alias}}( operation )
Returns the BLAS operation side string associated with a BLAS operation
side enumeration constant.

Parameters
----------
operation: integer
Operation enumeration constant.

Returns
-------
out: string|null
Operation string.

Examples
--------
> var out = {{alias}}( {{alias:@stdlib/blas/base/operation-side-str2enum}}( 'left' ) )
'left'

See Also
--------

41 changes: 41 additions & 0 deletions base/operation-side-enum2str/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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

/**
* Returns the BLAS operation side string associated with a BLAS operation side enumeration constant.
*
* @param operation - enumeration constant
* @returns operation string
*
* @example
* var str2enum = require( '@stdlib/blas/base/operation-side-str2enum' );
*
* var v = str2enum( 'left' );
* // returns <number>
*
* var s = enum2str( v );
* // returns 'left'
*/
declare function enum2str( operation: number ): string | null;


// EXPORTS //

export = enum2str;
39 changes: 39 additions & 0 deletions base/operation-side-enum2str/docs/types/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import enum2str = require( './index' );


// TESTS //

// The function returns a string or null...
{
enum2str( 0 ); // $ExpectType string | null
}

// The compiler throws an error if not provided a number...
{
enum2str( '10' ); // $ExpectError
enum2str( true ); // $ExpectError
enum2str( false ); // $ExpectError
enum2str( null ); // $ExpectError
enum2str( undefined ); // $ExpectError
enum2str( [] ); // $ExpectError
enum2str( {} ); // $ExpectError
enum2str( ( x: number ): number => x ); // $ExpectError
}
Loading

0 comments on commit d0de2b6

Please sign in to comment.