rc/gena/index.cpp:70: error: seq subscript (0) outside valid

[Old posts from the commercial version of ArrayFire] Discussion of ArrayFire using CUDA or OpenCL.

Moderator: pavanky

rc/gena/index.cpp:70: error: seq subscript (0) outside valid

Postby rm9 » Mon May 26, 2014 4:22 am

Hi ,

Can someone explain to me this error?
"src/gena/index.cpp:70: error: seq subscript (0) outside valid range [0,-1]"

Does it mean that the matrix is empty?
Thanks.
rm9
 
Posts: 54
Joined: Thu Jan 30, 2014 5:44 am

Re: rc/gena/index.cpp:70: error: seq subscript (0) outside v

Postby shehzan » Mon May 26, 2014 10:22 am

Hi

The error is shown when seq(x) is called and x is not in the valid range.
It looks like you are calling seq(0) on an uninitialized array.
Can you do a printdims on this and show the dimensions.
----
Shehzan
Developer
AccelerEyes
User avatar
shehzan
 
Posts: 121
Joined: Tue Feb 12, 2013 7:20 pm

Re: rc/gena/index.cpp:70: error: seq subscript (0) outside v

Postby rm9 » Mon May 26, 2014 10:32 am

This error happens randomly so I'm trying to print the dims but it might take awhile till I see it again.
I've narrowed the error to this line (I believe):
Code: Select all
probs = norms(seq(s, e)) / sum(norms(seq(s, e)));


I will update it when I have more details. Thanks!
rm9
 
Posts: 54
Joined: Thu Jan 30, 2014 5:44 am

Re: rc/gena/index.cpp:70: error: seq subscript (0) outside v

Postby shehzan » Mon May 26, 2014 11:12 am

You can add a condition like this
Code: Select all
if(norms.elements() <= 0 || s < 0 || e >= norms.elements())
    printf("Error: elements: %d \t  s %d \t e %d\n", norms.elements(), s, e);


This was you can check for errors yourself before calling the seq function. I just wrote a simple if condition. You can expand it as necessary.
----
Shehzan
Developer
AccelerEyes
User avatar
shehzan
 
Posts: 121
Joined: Tue Feb 12, 2013 7:20 pm

Re: rc/gena/index.cpp:70: error: seq subscript (0) outside v

Postby rm9 » Mon May 26, 2014 4:19 pm

Here is the dims of the matrix norms and also the variables s,e:
Code: Select all
norms dims=[1 1 1 128]
s,e: 84 ,87


The matrix seems to be with values and the weird thing is that it error happens every now and then and not all the time.
Maybe is it because the data is on the fourth dimension?
Thanks.
rm9
 
Posts: 54
Joined: Thu Jan 30, 2014 5:44 am

Re: rc/gena/index.cpp:70: error: seq subscript (0) outside v

Postby rm9 » Tue May 27, 2014 2:27 am

The error still happens even if I reorder the array so that the data is in the first dimension.
Is this a bug in ArrayFire ? very weird.
rm9
 
Posts: 54
Joined: Thu Jan 30, 2014 5:44 am

Re: rc/gena/index.cpp:70: error: seq subscript (0) outside v

Postby rm9 » Tue May 27, 2014 5:54 am

My bad, the bug was somewhere else.
I didn't use `seq` there so I didn't thought it was the bug, but I guess it uses seq inside.
Thanks for your help.
rm9
 
Posts: 54
Joined: Thu Jan 30, 2014 5:44 am


Return to [archive-commercial] Programming & Development with ArrayFire

cron