gonum.org/v1/gonum@v0.14.0/internal/asm/c64/stubs_noasm.go (about)

     1  // Copyright ©2016 The Gonum Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !amd64 || noasm || gccgo || safe
     6  // +build !amd64 noasm gccgo safe
     7  
     8  package c64
     9  
    10  // AxpyUnitary is
    11  //
    12  //	for i, v := range x {
    13  //		y[i] += alpha * v
    14  //	}
    15  func AxpyUnitary(alpha complex64, x, y []complex64) {
    16  	for i, v := range x {
    17  		y[i] += alpha * v
    18  	}
    19  }
    20  
    21  // AxpyUnitaryTo is
    22  //
    23  //	for i, v := range x {
    24  //		dst[i] = alpha*v + y[i]
    25  //	}
    26  func AxpyUnitaryTo(dst []complex64, alpha complex64, x, y []complex64) {
    27  	for i, v := range x {
    28  		dst[i] = alpha*v + y[i]
    29  	}
    30  }
    31  
    32  // AxpyInc is
    33  //
    34  //	for i := 0; i < int(n); i++ {
    35  //		y[iy] += alpha * x[ix]
    36  //		ix += incX
    37  //		iy += incY
    38  //	}
    39  func AxpyInc(alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) {
    40  	for i := 0; i < int(n); i++ {
    41  		y[iy] += alpha * x[ix]
    42  		ix += incX
    43  		iy += incY
    44  	}
    45  }
    46  
    47  // AxpyIncTo is
    48  //
    49  //	for i := 0; i < int(n); i++ {
    50  //		dst[idst] = alpha*x[ix] + y[iy]
    51  //		ix += incX
    52  //		iy += incY
    53  //		idst += incDst
    54  //	}
    55  func AxpyIncTo(dst []complex64, incDst, idst uintptr, alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) {
    56  	for i := 0; i < int(n); i++ {
    57  		dst[idst] = alpha*x[ix] + y[iy]
    58  		ix += incX
    59  		iy += incY
    60  		idst += incDst
    61  	}
    62  }
    63  
    64  // DotcUnitary is
    65  //
    66  //	for i, v := range x {
    67  //		sum += y[i] * conj(v)
    68  //	}
    69  //	return sum
    70  func DotcUnitary(x, y []complex64) (sum complex64) {
    71  	for i, v := range x {
    72  		sum += y[i] * conj(v)
    73  	}
    74  	return sum
    75  }
    76  
    77  // DotcInc is
    78  //
    79  //	for i := 0; i < int(n); i++ {
    80  //		sum += y[iy] * conj(x[ix])
    81  //		ix += incX
    82  //		iy += incY
    83  //	}
    84  //	return sum
    85  func DotcInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) {
    86  	for i := 0; i < int(n); i++ {
    87  		sum += y[iy] * conj(x[ix])
    88  		ix += incX
    89  		iy += incY
    90  	}
    91  	return sum
    92  }
    93  
    94  // DotuUnitary is
    95  //
    96  //	for i, v := range x {
    97  //		sum += y[i] * v
    98  //	}
    99  //	return sum
   100  func DotuUnitary(x, y []complex64) (sum complex64) {
   101  	for i, v := range x {
   102  		sum += y[i] * v
   103  	}
   104  	return sum
   105  }
   106  
   107  // DotuInc is
   108  //
   109  //	for i := 0; i < int(n); i++ {
   110  //		sum += y[iy] * x[ix]
   111  //		ix += incX
   112  //		iy += incY
   113  //	}
   114  //	return sum
   115  func DotuInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) {
   116  	for i := 0; i < int(n); i++ {
   117  		sum += y[iy] * x[ix]
   118  		ix += incX
   119  		iy += incY
   120  	}
   121  	return sum
   122  }