time-to-botec

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

README.md (2446B)


      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 # numel
     22 
     23 > Return the number of elements in an array.
     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 numel = require( '@stdlib/ndarray/base/numel' );
     41 ```
     42 
     43 #### numel( shape )
     44 
     45 Returns number of elements in an array.
     46 
     47 ```javascript
     48 var n = numel( [ 3, 2, 3 ] );
     49 // returns 18
     50 ```
     51 
     52 </section>
     53 
     54 <!-- /.usage -->
     55 
     56 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     57 
     58 <section class="notes">
     59 
     60 </section>
     61 
     62 <!-- /.notes -->
     63 
     64 <!-- Package usage examples. -->
     65 
     66 <section class="examples">
     67 
     68 ## Examples
     69 
     70 <!-- eslint no-undef: "error" -->
     71 
     72 ```javascript
     73 var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
     74 var numel = require( '@stdlib/ndarray/base/numel' );
     75 
     76 var shape;
     77 var n;
     78 var i;
     79 
     80 shape = [ 0, 0, 0 ];
     81 for ( i = 0; i < 100; i++ ) {
     82     // Generate random NxMxL dimensions:
     83     shape[ 0 ] = discreteUniform( 1, 10 );
     84     shape[ 1 ] = discreteUniform( 2, 7 );
     85     shape[ 2 ] = discreteUniform( 1, 12 );
     86 
     87     n = numel( shape );
     88     console.log( '%s => %d elements', shape.join( 'x' ), n );
     89 }
     90 ```
     91 
     92 </section>
     93 
     94 <!-- /.examples -->
     95 
     96 <!-- 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. -->
     97 
     98 <section class="references">
     99 
    100 </section>
    101 
    102 <!-- /.references -->
    103 
    104 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    105 
    106 <section class="links">
    107 
    108 </section>
    109 
    110 <!-- /.links -->