![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unix addition ( Row wise) | gauravgoel | Shell Programming and Scripting | 3 | 05-17-2007 04:27 AM |
| Paste coulmn wise | er_aparna | Shell Programming and Scripting | 3 | 06-26-2006 04:16 AM |
| Manipulating fields record wise | rinku11 | Shell Programming and Scripting | 1 | 12-07-2005 10:42 AM |
| System RAM identification slot-wise | diliphere | UNIX for Advanced & Expert Users | 0 | 08-23-2005 08:45 AM |
| listing files and directory in Page wise | smdakram | UNIX for Dummies Questions & Answers | 1 | 01-12-2002 01:12 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
processing matrix column wise
I have a m X n matrix written out to file, say like this:
1,2,3,4,5,6 2,6,3,10,34,67 1,45,6,7,8,8 I want to calculate the column averages in the MINIMUM amount of code or processing possible. I would have liked to use my favorite tool, "AWK" but since it processes rowwise, getting the average of the first column values wud mean one call, getting the average of the second column values wud mean another call....so on till 'n' calls. Is there a better way to this? You may also suggest a different way to represent the mXn matrix, as long I can conceptually map a mXn matrix to the suggested file format. Please help. |
|
||||
|
risk of overflow?
First of all, thanks for the response.
The order of my matrix is curently 2000 X 1000....but it might increase over time. Is there a possibility of memory overflow? This is one reason why I didnt want to store many values in a code... preferable is if I could process them and output as they come, maintaining the minimum number of variables in the code. |
|
|||||
|
the memory allocation is only limited by the physical/virtual memory configured on your box.
If you're on Solaris and using 'nawk' you would hit the limitation on the number of fields in a record much sooner than you'd notice the 'noticable' mmory aloocation issues. If you can thing of the algorithm to achieve what you're trying to with out using a hash/array REGARDLESS of the implementation language, pls do share. You might want post to USENET's comp.lang.awk - they're resourceful bunch! |
|
|||||
|
I guess one way would be to invert the matrix and process a row (what used to be a 'column') in one shot producing avg.
Now... whether inverting the matrix and rprocessing the inverted matrix would be either quicker and/or less 'memory-consuming'.... that's a different issue. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|