time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (2837B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2018 The Stdlib Authors.
      6 
      7 Licensed under the Apache License, Version 2.0 (the "License");
      8 you may not use this file except in compliance with the License.
      9 You may obtain a copy of the License at
     10 
     11    http://www.apache.org/licenses/LICENSE-2.0
     12 
     13 Unless required by applicable law or agreed to in writing, software
     14 distributed under the License is distributed on an "AS IS" BASIS,
     15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 See the License for the specific language governing permissions and
     17 limitations under the License.
     18 
     19 -->
     20 
     21 # Index Modes
     22 
     23 > List of ndarray index modes.
     24 
     25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
     26 
     27 <section class="intro">
     28 
     29 </section>
     30 
     31 <!-- /.intro -->
     32 
     33 <!-- Package usage documentation. -->
     34 
     35 <section class="usage">
     36 
     37 ## Usage
     38 
     39 ```javascript
     40 var modes = require( '@stdlib/ndarray/index-modes' );
     41 ```
     42 
     43 #### modes()
     44 
     45 Returns a list of ndarray index modes.
     46 
     47 ```javascript
     48 var out = modes();
     49 // returns [ 'throw', 'clamp', 'wrap' ]
     50 ```
     51 
     52 The output `array` contains the following modes:
     53 
     54 -   `throw`: specifies that a function should throw an error when an index is outside a restricted interval.
     55 -   `wrap`: specifies that a function should wrap around an index using modulo arithmetic.
     56 -   `clamp`: specifies that a function should set an index less than `0` to `0` (minimum index) and set an index greater than a maximum index value to the maximum possible index.
     57 
     58 </section>
     59 
     60 <!-- /.usage -->
     61 
     62 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     63 
     64 <section class="notes">
     65 
     66 </section>
     67 
     68 <!-- /.notes -->
     69 
     70 <!-- Package usage examples. -->
     71 
     72 <section class="examples">
     73 
     74 ## Examples
     75 
     76 <!-- eslint no-undef: "error" -->
     77 
     78 ```javascript
     79 var indexOf = require( '@stdlib/utils/index-of' );
     80 var modes = require( '@stdlib/ndarray/index-modes' );
     81 
     82 var MODES = modes();
     83 var bool;
     84 
     85 function isMode( str ) {
     86     if ( indexOf( MODES, str ) === -1 ) {
     87         return false;
     88     }
     89     return true;
     90 }
     91 
     92 bool = isMode( 'throw' );
     93 // returns true
     94 
     95 bool = isMode( 'clamp' );
     96 // returns true
     97 
     98 bool = isMode( 'wrap' );
     99 // returns true
    100 
    101 bool = isMode( 'beep' );
    102 // returns false
    103 ```
    104 
    105 </section>
    106 
    107 <!-- /.examples -->
    108 
    109 <!-- 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. -->
    110 
    111 <section class="references">
    112 
    113 </section>
    114 
    115 <!-- /.references -->
    116 
    117 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    118 
    119 <section class="links">
    120 
    121 </section>
    122 
    123 <!-- /.links -->