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 10:51:02 +0100

> 
> I am working on testcases for the GSL BLAS and CBLAS functionality and my
> testdata also includes negative stride for vectors.
> 
> Is there a specific reason why the GSL implementation does not allow
> negative stride (ATLAS also does not consider this, MKL does)?

ATLAS also allows negative strides.  Otherwise it would not pass the BLAS
test suite.

When I countered negative strides in BLAS I was confused by its meaning: In
my expectation having a vector of length n, data pointer X and a stride
of -1 then it would have references elements

 *X, *(X-1), *(X-2), ..., *(X-n+1)

However, in BLAS a negative stride just means that one has to traverse the 
elements
in reverse order, i.e.

 *(X+n-1), *(X+n-2), ..., *(X+1), *X

But the elements that are actually referenced are the same you would have for
stride 1=abs(-1), i.e.

 *X, *(X+1), *(X+2), ..., *(X+n-1)

So maybe you stumbled over the same misunderstanding I once had?


Cheers,

Michael


> 
> Beside this, the BLAS spec. allows for negative stride.
> 
> 
> Thanks in advance.
> 
> best,
> Stephan Petzchen
> 
> 





reply via email to

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