Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,245 Programmers. There are 2,250 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

SLICING IN A PROGRAMMING LANGUAGE

 
Reply to this topicStart new topic

SLICING IN A PROGRAMMING LANGUAGE

2+2=5
post 1 May, 2008 - 08:11 AM
Post #1


New D.I.C Head

*
Joined: 1 May, 2008
Posts: 1



HI

how do i implement slicing on a 3-d array( in a languagewhich of course does not support slicing). As in, how do i use the input parameters to get to the slice.
For instance if i have a function 'slice' defined as :
slice(row,column,depth)
how do i use the combination of row,column and depth to figure out my slice-In Fortran 95 for example, doing something like Cube(2,:,:,) would give me the whole of the second layer of a 3 by 3 by 4 array.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


perfectly.insane
post 4 May, 2008 - 02:09 PM
Post #2


New D.I.C Head

*
Joined: 22 Mar, 2008
Posts: 34

Usually, slicing implies making a copy of the data, so your slice function would need to allocate an array of the specified size, and then copy the specified data to it. How you would do it for a 3-D array depends on how you want to implement the 3-D array itself. If you have three dimensions, then the most obvious way would be to have three nested for loops to copy the data based upon the input parameters.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 08:38AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month