C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 1st, 2003, 10:43 AM
marek_haj's Avatar
marek_haj marek_haj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: currently Lisbone, Portugal
Posts: 154 marek_haj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 28 m
Reputation Power: 6
Lightbulb Multidimensional data matrices under c++

Hello,
I was happily writing in c++ today when I came across a problem. I need a 3D float number matrix to store results of calculations. So far I know of 1D and 2D matrices. Is there any way of creating a 3D one, for storing (xyz) coordinates for example?
I can think of one way but is requires recalculation of parameters and a lot of computation time to decode.
I am open to all suggestions
Thanks for all posts
Best greets
MArek

Reply With Quote
  #2  
Old April 1st, 2003, 12:23 PM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,327 7stud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 44 m 50 sec
Reputation Power: 9
float matrix[50][50][50];

Reply With Quote
  #3  
Old April 1st, 2003, 01:13 PM
marek_haj's Avatar
marek_haj marek_haj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: currently Lisbone, Portugal
Posts: 154 marek_haj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 28 m
Reputation Power: 6
hm, that was too simple for me to think out I guess.
Now a stupid question, does this work for float matrix [x][x][x][x] as well??
So far I have been decoding addresses into such a fashion:
x^3*firstadress+x^2*secondadress+x*thirdadress+fourthadress, where x is the maximal dimension of the matrix. This also works though I have to operate on one hell-of-a-long matrix and there is always much more operations with decodning addresses correctly.
Thanks for posts
Best greets
MArek

Reply With Quote
  #4  
Old April 1st, 2003, 01:57 PM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 3,803 dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Month 11 h 56 m 57 sec
Reputation Power: 437
Quote:
Originally posted by marek_haj
Now a stupid question, does this work for float matrix [x][x][x][x] as well??


Yes, of course it does in just that fashion. I believe that you can go up to seven dimensions -- but check your compiler's documentation first.

Reply With Quote
  #5  
Old April 1st, 2003, 02:03 PM
Doctor - A Doctor - A is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 11 Doctor - A User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You can use dinamic mammory as

X[][] is pointer X**
x[][][] is pointer X***
and so on.

Reply With Quote
  #6  
Old April 1st, 2003, 02:15 PM
marek_haj's Avatar
marek_haj marek_haj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: currently Lisbone, Portugal
Posts: 154 marek_haj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 28 m
Reputation Power: 6
Thanks a lot
That really solves me a lot of unneccessary work.
You are the best
Best greets & thanks for all posts
MArek

Reply With Quote
  #7  
Old April 2nd, 2003, 02:13 AM
marek_haj's Avatar
marek_haj marek_haj is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: currently Lisbone, Portugal
Posts: 154 marek_haj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 28 m
Reputation Power: 6
and works really fine.
Now the program runs like gold and there are no problems with excessive position decoding. Thanks a lot guys
Best greets
MArek

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Multidimensional data matrices under c++


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway