help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Why is Negative Stride in GSL not allowed?


From: Michael Lehn
Subject: Re: [Help-gsl] Why is Negative Stride in GSL not allowed?
Date: Mon, 19 Nov 2012 11:18:56 +0100

> I think my understanding of negative stride is as follows and probably 
> matching with yours:
> 
> 
> BLAS Specification: http://www.netlib.org/blas/blast-forum/
> Chapter 2.5.3: Dense and Banded BLAS

Yes, great reference!

> 
> INCX != 0
> i = 1,....N
> for INCX >0: X(1 + (i-1) * INCX)
> for INCX <0: X(1 + (n-i) * abs(INCX))

Yes, you've been faster then me, so forget about my other mail.


> 
> so for example:
> 
> X: {1.0  2.0  3.0  4.0  5.0  6.0  7.0  8.0  9.0  10.0}
> n =  elements to be processed = 4
> INCX = -2
> i = 2
> 
> X(1 + (4-2) * abs(-2)) = X(6) = 6.0
> 
> 
> 
> But when I look up the ATLAS source for example for computing: the sum \alpha 
> + x^T y for the vectors x and y
> the negative stride is not considered here. DO I oversee here something?
> 

There should be code like this

  if (incX<0) {
      x -= incX*(n-1)
  }

somewhere.  This would move the data pointer to the last element of the vector. 
 The negative stride remains
unchanged.  


Cheers,

Michael




reply via email to

[Prev in Thread] Current Thread [Next in Thread]