Ubound gives incorrect result

Ubound gives incorrect result

The two Dim array should give 29x5, it gives 5x5.

Notice that SIZE does give the correct count = 29*5 =145

附件尺寸
下载 main_2.f90369 字节
16 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Why is it that when I uploaded 2 files, it only shows one file ?

Did the other file actually get loaded? It said that it uploaded 2 files.

Dont they test this stuff?

I see only one file. Upload the second one. My guess is that UBOUND is correct but I need to see the rest.

Steve - Intel Developer Support

Ok, are we allowed only one file upload per visit?

I will upload the 2nd one later.

But if it displays 2 files when I upload it,

why doesn't it show both to you?

 

actually, it tried to upload the main routine 3 times, and gave a different name to the same file, rather than replacing it.

 

Thats why we see Main, main-1 ,and main-2.

One can upload multiple files and it is done often. I don't know how you tried to do the upload. There are two steps - first you have to select the files and then click "Upload". Yes, it will rename files if there are duplicates (or sometimes even if there aren't.) 

Steve - Intel Developer Support

WELL, THAT IS EXACTLY WHAT I DID -

I SELECTED TWO FILES TWO BE UPLOADED,

and then said "begin upload." It said two files uploaded. 

But then when I displayed it, it only showed one file.

So what happened to the other file?

I am going to do it again, but this time will put the other

file FIRST in the list.

Now this should have two files attached, according to what I see on the screen for "preview."

附件: 

附件尺寸
下载 myfuncts_1.f90610 字节
下载 main_2.f90369 字节

OK, it did it again. I saw two files on the PREVIEW, but when I display it, it only shows ONE file.

How many files actually got uploaded ?

OK, out of sheer desperation, I will upload just one file, lets see what happens then.

This one is called MYFUNCTS.F90

附件: 

附件尺寸
下载 myfuncts_1.f90610 字节

One point of confusion -

when you say "upload files" your choices are "NEXT and CANCEL".

Shouldn't it say "DONE?" A minor point, but it could fool some people.

What would be "NEXT?"

Uploading and attaching are separate, if related, activities. To attach a file, it is required that the file be present in your file storage area.

If you have files already present in your storage area, you can select and attach them without any uploading; conversely you may upload files without posting a message, or you may post a message without attaching a file.

Files that have been uploaded remain in your file storage area forever, pending Intel's granting users the ability and means to delete uploaded files that are no longer needed.

It uploaded two this time - thanks.

In aver2d, you used UBOUND(a,2). This returns a scalar that is the upper bound of dimension 2. You then assigned this to a two-element array so you got 5 in both elements. What you wanted instead was UBOUND(a).

Next brings you back to the post so you can continue editing.

Steve - Intel Developer Support

The problem was originally caused by a compiler error when I leave off the 2nd argument (#6366.)

But it does NOT occur for 2d and3d arrays, only 1d arrays.

So I assumed that has to be supplied for a 2d or 3d array. apparently the usage is not consistent.

I am uploading another main program main_48.f90 that includes a 3d array.

and an enhanced version of myfuncts.f90

 

did you get two files this time? It said two files - - 

 

BTW it says "file attachments may not load with IE 8."

But I am using CHROME for my browser.

How do I send a screen shot? I would like you to see what it does.

 

One thing that looks suspicious: The order for one of them says "0"

Is that acceptable?

附件: 

附件尺寸
下载 myfuncts_1.f90986 字节
下载 main_48.f90562 字节

Check out lines 42 and 43, those are related to the compiler issue error 6366.

Of myfuncts_1.f90 that is.

Ok. In the case of aver1d, you have declared lba and uba to be scalars. LBOUND and UBOUND, when DIM is not supplied, return arrays. You're not allowed to assign an array to a scalar.

One fix is to make lba and uba arrays with one element and call LBOUND and UBOUND without the DIM argument. This is probably the best choice as it means the code is pretty much the same other than the rank of the arguments and dimensions of the lba/uba variables.

Steve - Intel Developer Support

OK I will try that.

It would nice if they gave us better examples.

This is a fundamental aspect of the Fortran language. We provide reference documentation, but aren't trying to teach you Fortran. There are some excellent books out there that do that, the most popular of which is Modern Fortran Explained.

Steve - Intel Developer Support

发表评论

登录添加评论。还不是成员?立即加入