github.com/gopherd/gonum@v0.0.4/internal/asm/c64/scal.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  package c64
     6  
     7  // ScalUnitary is
     8  //  for i := range x {
     9  //  	x[i] *= alpha
    10  //  }
    11  func ScalUnitary(alpha complex64, x []complex64) {
    12  	for i := range x {
    13  		x[i] *= alpha
    14  	}
    15  }
    16  
    17  // ScalUnitaryTo is
    18  //  for i, v := range x {
    19  //  	dst[i] = alpha * v
    20  //  }
    21  func ScalUnitaryTo(dst []complex64, alpha complex64, x []complex64) {
    22  	for i, v := range x {
    23  		dst[i] = alpha * v
    24  	}
    25  }
    26  
    27  // ScalInc is
    28  //  var ix uintptr
    29  //  for i := 0; i < int(n); i++ {
    30  //  	x[ix] *= alpha
    31  //  	ix += incX
    32  //  }
    33  func ScalInc(alpha complex64, x []complex64, n, incX uintptr) {
    34  	var ix uintptr
    35  	for i := 0; i < int(n); i++ {
    36  		x[ix] *= alpha
    37  		ix += incX
    38  	}
    39  }
    40  
    41  // ScalIncTo is
    42  //  var idst, ix uintptr
    43  //  for i := 0; i < int(n); i++ {
    44  //  	dst[idst] = alpha * x[ix]
    45  //  	ix += incX
    46  //  	idst += incDst
    47  //  }
    48  func ScalIncTo(dst []complex64, incDst uintptr, alpha complex64, x []complex64, n, incX uintptr) {
    49  	var idst, ix uintptr
    50  	for i := 0; i < int(n); i++ {
    51  		dst[idst] = alpha * x[ix]
    52  		ix += incX
    53  		idst += incDst
    54  	}
    55  }
    56  
    57  // SscalUnitary is
    58  //  for i, v := range x {
    59  //  	x[i] = complex(real(v)*alpha, imag(v)*alpha)
    60  //  }
    61  func SscalUnitary(alpha float32, x []complex64) {
    62  	for i, v := range x {
    63  		x[i] = complex(real(v)*alpha, imag(v)*alpha)
    64  	}
    65  }
    66  
    67  // SscalInc is
    68  //  var ix uintptr
    69  //  for i := 0; i < int(n); i++ {
    70  //  	x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha)
    71  //  	ix += inc
    72  //  }
    73  func SscalInc(alpha float32, x []complex64, n, inc uintptr) {
    74  	var ix uintptr
    75  	for i := 0; i < int(n); i++ {
    76  		x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha)
    77  		ix += inc
    78  	}
    79  }