home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!comp.vuw.ac.nz!newshost.wcc.govt.nz!kosmos.wcc.govt.nz!THOMSON_N
- From: thomson_n@kosmos.wcc.govt.nz
- Newsgroups: comp.lang.c++
- Subject: Copying 4D array's
- Date: 8 Jan 1993 11:02:23 GMT
- Organization: Wellington City Council (Public Access), Wgtn, Nz
- Lines: 66
- Message-ID: <1ijmvvINNk05@golem.wcc.govt.nz>
- Reply-To: thomson_n@kosmos.wcc.govt.nz
- NNTP-Posting-Host: kosmos.wcc.govt.nz
-
-
- I've got a problem, which I hope someone on the net can solve for me.
-
- I'm new to the C language, but are programming in highc over the summer.
- My main problem is the run time of certain parts of my program.
-
- I am trying to copy a 4D array to another 4D array and to a 1D array.
-
-
- Currently I am simply using a nested for loop.
-
- "
-
- for(i=0;i<=MAX_BUS;i++)
- for(j=year_req.start;j<=year_req.end;j++)
- for(k=month_req.start;k<=month_req.end;k++)
- for(l=min_isle;l<=max_isle;l++)
-
- graph_data[i][j][k][l] = column_A[i][j][k][l];
-
-
-
- "
-
- It is not possible, given the rest of the program, to get around copying the
- array over, but I really need a faster method of doing this. Currently It's
- running on a digital 433dx workstation.
-
-
- The second problem I have, which is much the same as the first, is that I
- also need to copy this 4D array to a 1D array. This is done by calling a
- function with the arguments of year, month, day, and halfhour. This function
- date_to_hh_num returns an integer value, of the number of half hours since
- 1/1/1960
-
- The question here, is again, is there any way to speed up this process?
-
-
- for(yr1=year_req.start;yr1<=year_req.end;yr1++)
- yr = yr1-year_req.start;
- for(mo=month_req.start;mo<=month_req.end;mo++)
- for(da=day_req.start;da<=day_req.end;da++)
- for (hh=time_req.start;hh<=time_req.end;hh++) {
- current_hh_num = date_to_hh_num(yr,mo,da,hh);
- graph_data[current_hh_num] = column_A[yr][mo][da][hh];
- }
- "
-
-
- Thanks in advance :)
-
- Replies by email please.
-
-
- --
-
- +----------------------------------------------------------------------------+
- | cheesecake = Nigel Thomson Email: THOMSON_N@kosmos.wcc.govt.nz |
- | ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
- | They don't call me cheesecake for nothing :: |
- | :::::) Chocolate cheesecake with Baileys :) :: |
- | :: *NOT* a Happy Smily Monster:: |
- | ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
- +----------------------------------------------------------------------------+
-
-
-