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 6286f6e commit 1542a8c
Show file tree
Hide file tree
Showing 11 changed files with 580 additions and 0 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,28 @@ This release closes the following issue:

<!-- /.package -->

<section class="package" id="blas-base-matrix-triangle-resolve-str-unreleased">

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

<details>

<section class="features">

##### Features

- [`50316e4`](https://github.com/stdlib-js/stdlib/commit/50316e43a7f59092f56aebcd2acfa815871ae3bf) - add `blas/base/matrix-triangle-resolve-str` [(#2496)](https://github.com/stdlib-js/stdlib/pull/2496)

</section>

<!-- /.features -->

</details>

</section>

<!-- /.package -->

<section class="package" id="blas-base-matrix-triangle-str2enum-unreleased">

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

<details>

- [`50316e4`](https://github.com/stdlib-js/stdlib/commit/50316e43a7f59092f56aebcd2acfa815871ae3bf) - **feat:** add `blas/base/matrix-triangle-resolve-str` [(#2496)](https://github.com/stdlib-js/stdlib/pull/2496) _(by Pranav Goswami, Athan Reines)_
- [`1493a14`](https://github.com/stdlib-js/stdlib/commit/1493a1446311df5c8b643e3429dba4c8850fc227) - **feat:** add `blas/base/diagonal-type-*` utilities [(#2498)](https://github.com/stdlib-js/stdlib/pull/2498) _(by Pranav Goswami, Athan Reines)_
- [`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)_
Expand Down
121 changes: 121 additions & 0 deletions base/matrix-triangle-resolve-str/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.
-->

# resolve

> Return the matrix triangle string associated with a supported BLAS matrix triangle value.
<!-- 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 resolve = require( '@stdlib/blas/base/matrix-triangle-resolve-str' );
```

#### resolve( value )

Returns the matrix triangle string associated with a BLAS matrix triangle value.

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

var v = resolve( 'upper' );
// returns 'upper'

v = resolve( str2enum( 'upper' ) );
// returns 'upper'
```

If unable to resolve a matrix triangle string, the function returns `null`.

```javascript
var v = resolve( 'beep' );
// 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/matrix-triangle-str2enum' );
var resolve = require( '@stdlib/blas/base/matrix-triangle-resolve-str' );

var v = resolve( str2enum( 'upper' ) );
// returns 'upper'

v = resolve( str2enum( 'lower' ) );
// returns 'lower'
```

</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 -->
80 changes: 80 additions & 0 deletions base/matrix-triangle-resolve-str/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* @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/matrix-triangle-str2enum' );
var pkg = require( './../package.json' ).name;
var resolve = require( './../lib' );


// MAIN //

bench( pkg+'::string', function benchmark( b ) {
var values;
var out;
var i;

values = [
'upper',
'lower'
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
out = resolve( 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();
});

bench( pkg+'::integer', function benchmark( b ) {
var values;
var out;
var i;

values = [
str2enum( 'upper' ),
str2enum( 'lower' )
];

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
out = resolve( 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();
});
25 changes: 25 additions & 0 deletions base/matrix-triangle-resolve-str/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

{{alias}}( value )
Returns the matrix triangle string associated with a supported BLAS matrix
triangle value.

Parameters
----------
value: any
Matrix triangle value.

Returns
-------
out: string|null
Matrix triangle string.

Examples
--------
> var out = {{alias}}( 'upper' )
'upper'
> out = {{alias}}( {{alias:@stdlib/blas/base/matrix-triangle-str2enum}}( 'upper' ) )
'upper'

See Also
--------

38 changes: 38 additions & 0 deletions base/matrix-triangle-resolve-str/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* @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 matrix triangle string associated with a BLAS matrix triangle value.
*
* @param value - matrix triangle value
* @returns matrix triangle string
*
* @example
* var str2enum = require( '@stdlib/blas/base/matrix-triangle-str2enum' );
*
* var v = resolve( str2enum( 'upper' ) );
* // returns 'upper'
*/
declare function resolve( value: any ): string | null;


// EXPORTS //

export = resolve;
28 changes: 28 additions & 0 deletions base/matrix-triangle-resolve-str/docs/types/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* @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 resolve = require( './index' );


// TESTS //

// The function returns a string or null...
{
resolve( 0 ); // $ExpectType string | null
resolve( 'upper' ); // $ExpectType string | null
}
30 changes: 30 additions & 0 deletions base/matrix-triangle-resolve-str/examples/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @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';

var str2enum = require( './../../../base/matrix-triangle-str2enum' );
var resolve = require( './../lib' );

var v = resolve( str2enum( 'upper' ) );
console.log( v );
// => 'upper'

v = resolve( str2enum( 'lower' ) );
console.log( v );
// => 'lower'
Loading

0 comments on commit 1542a8c

Please sign in to comment.