time-to-botec

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

ccopy.f (2817B)


      1 !>
      2 ! @license Apache-2.0
      3 !
      4 ! Copyright (c) 2020 The Stdlib Authors.
      5 !
      6 ! Licensed under the Apache License, Version 2.0 (the "License");
      7 ! you may not use this file except in compliance with the License.
      8 ! You may obtain a copy of the License at
      9 !
     10 !    http://www.apache.org/licenses/LICENSE-2.0
     11 !
     12 ! Unless required by applicable law or agreed to in writing, software
     13 ! distributed under the License is distributed on an "AS IS" BASIS,
     14 ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 ! See the License for the specific language governing permissions and
     16 ! limitations under the License.
     17 !<
     18 
     19 !> Copies values from one complex single-precision floating-point vector to another complex single-precision floating-point vector.
     20 !
     21 ! ## Notes
     22 !
     23 ! * Modified version of reference BLAS level1 routine (version 3.9.0). Updated to "free form" Fortran 95.
     24 !
     25 ! ## Authors
     26 !
     27 ! * Univ. of Tennessee
     28 ! * Univ. of California Berkeley
     29 ! * Univ. of Colorado Denver
     30 ! * NAG Ltd.
     31 !
     32 ! ## History
     33 !
     34 ! * Jack Dongarra, linpack, 3/11/78.
     35 !
     36 !   - modified 12/3/93, array(1) declarations changed to array(*)
     37 !
     38 ! ## License
     39 !
     40 ! From <http://netlib.org/blas/faq.html>:
     41 !
     42 ! > The reference BLAS is a freely-available software package. It is available from netlib via anonymous ftp and the World Wide Web. Thus, it can be included in commercial software packages (and has been). We only ask that proper credit be given to the authors.
     43 ! >
     44 ! > Like all software, it is copyrighted. It is not trademarked, but we do ask the following:
     45 ! >
     46 ! > * If you modify the source for these routines we ask that you change the name of the routine and comment the changes made to the original.
     47 ! >
     48 ! > * We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support.
     49 !
     50 ! @param {integer} N - number of values to copy
     51 ! @param {Array<complex>} cx - input array
     52 ! @param {integer} strideX - `cx` stride length
     53 ! @param {Array<complex>} cy - destination array
     54 ! @param {integer} strideY - `cy` stride length
     55 !<
     56 subroutine ccopy( N, cx, strideX, cy, strideY )
     57   implicit none
     58   ! ..
     59   ! Scalar arguments:
     60   integer :: strideX, strideY, N
     61   ! ..
     62   ! Array arguments:
     63   complex :: cx(*), cy(*)
     64   ! ..
     65   ! Local scalars:
     66   integer :: ix, iy, i
     67   ! ..
     68   if ( N <= 0 ) then
     69     return
     70   end if
     71   ! ..
     72   if ( strideX == 1 .AND. strideY == 1 ) then
     73     do i = 1, N
     74       cy( i ) = cx( i )
     75     end do
     76   else
     77     if ( strideX < 0 ) then
     78       ix = ((1-N)*strideX) + 1
     79     else
     80       ix = 1
     81     end if
     82     if ( strideY < 0 ) then
     83       iy = ((1-N)*strideY) + 1
     84     else
     85       iy = 1
     86     end if
     87     do i = 1, N
     88       cy( iy ) = cx( ix )
     89       ix = ix + strideX
     90       iy = iy + strideY
     91     end do
     92   end if
     93   return
     94 end subroutine ccopy