time-to-botec

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

repl.txt (4235B)


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