time-to-botec

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

repl.txt (4080B)


      1 
      2 {{alias}}( N, x, strideX, y, strideY )
      3     Computes the dot product of two single-precision floating-point vectors with
      4     extended accumulation and result.
      5 
      6     The `N`, `strideX`, and `strideY` parameters determine which elements in `x`
      7     and `y` are accessed at runtime.
      8 
      9     Indexing is relative to the first index. To introduce an offset, use a typed
     10     array view.
     11 
     12     If `N <= 0` the function returns `0.0`.
     13 
     14     Parameters
     15     ----------
     16     N: integer
     17         Number of indexed elements.
     18 
     19     x: Float32Array
     20         First input array.
     21 
     22     strideX: integer
     23         Index increment for `x`.
     24 
     25     y: Float32Array
     26         Second input array.
     27 
     28     strideY: integer
     29         Index increment for `y`.
     30 
     31     Returns
     32     -------
     33     dot: number
     34         The dot product of `x` and `y`.
     35 
     36     Examples
     37     --------
     38     // Standard usage:
     39     > var x = new {{alias:@stdlib/array/float32}}( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );
     40     > var y = new {{alias:@stdlib/array/float32}}( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );
     41     > var dot = {{alias}}( x.length, x, 1, y, 1 )
     42     -5.0
     43 
     44     // Strides:
     45     > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
     46     > y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
     47     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     48     > dot = {{alias}}( N, x, 2, y, -1 )
     49     9.0
     50 
     51     // Using view offsets:
     52     > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
     53     > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
     54     > var x1 = new {{alias:@stdlib/array/float32}}( x.buffer, x.BYTES_PER_ELEMENT*1 );
     55     > var y1 = new {{alias:@stdlib/array/float32}}( y.buffer, y.BYTES_PER_ELEMENT*3 );
     56     > N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     57     > dot = {{alias}}( N, x1, -2, y1, 1 )
     58     128.0
     59 
     60 {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY )
     61     Computes the dot product of two single-precision floating-point vectors
     62     using alternative indexing semantics and with extended accumulation and
     63     result.
     64 
     65     While typed array views mandate a view offset based on the underlying
     66     buffer, the `offsetX` and `offsetY` parameters support indexing based on a
     67     starting index.
     68 
     69     Parameters
     70     ----------
     71     N: integer
     72         Number of indexed elements.
     73 
     74     x: Float32Array
     75         First input array.
     76 
     77     strideX: integer
     78         Index increment for `x`.
     79 
     80     offsetX: integer
     81         Starting index for `x`.
     82 
     83     y: Float32Array
     84         Second input array.
     85 
     86     strideY: integer
     87         Index increment for `y`.
     88 
     89     offsetY: integer
     90         Starting index for `y`.
     91 
     92     Returns
     93     -------
     94     dot: number
     95         The dot product of `x` and `y`.
     96 
     97     Examples
     98     --------
     99     // Standard usage:
    100     > var x = new {{alias:@stdlib/array/float32}}( [ 4.0, 2.0, -3.0, 5.0, -1.0 ] );
    101     > var y = new {{alias:@stdlib/array/float32}}( [ 2.0, 6.0, -1.0, -4.0, 8.0 ] );
    102     > var dot = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 )
    103     -5.0
    104 
    105     // Strides:
    106     > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
    107     > y = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
    108     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
    109     > dot = {{alias}}.ndarray( N, x, 2, 0, y, 2, 0 )
    110     9.0
    111 
    112     // Using offset indices:
    113     > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
    114     > y = new {{alias:@stdlib/array/float32}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
    115     > N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
    116     > dot = {{alias}}.ndarray( N, x, -2, x.length-1, y, 1, 3 )
    117     128.0
    118 
    119     References
    120     ----------
    121     - Lawson, Charles L., Richard J. Hanson, Fred T. Krogh, and David Ronald
    122     Kincaid. 1979. "Algorithm 539: Basic Linear Algebra Subprograms for Fortran
    123     Usage [F1]." *ACM Transactions on Mathematical Software* 5 (3). New York,
    124     NY, USA: Association for Computing Machinery: 324–25.
    125     doi:10.1145/355841.355848.
    126 
    127     See Also
    128     --------
    129