|
||||||
| General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
function b=genArray(a,d)
The function genArray(a,d) has two parameters in which a is an array and d is the nonlinearity degree and the output is a new array b. The function does the following job For example: a=[a1 a2 a3]; if d=1 b=[a1 a2 a3]; if d=2 b=[a1 a2 a3 a1*a1 a1*a2 a1*a3 a2*a2 a2*a3 a3*a3]; if d=3 b=[a1 a2 a3 a1*a1 a1*a2 a1*a3 a2*a2 a2*a3 a3*a3 a1*a1*a1 a1*a1*a2 a1*a1*a3 a1*a2*a2 a1*a2*a3 a1*a3*a3 a2*a2*a2 a2*a2*a3 a2*a3*a3 a3*a3*a3]; if d=4 and so on..... I have been thinking this for a couple of days, but not able to form a solution... any ideas will be much appreciated! |
| Sponsored Links |
|
|
|
|||
|
hi, vAC, thank you very much for your kind solution. It makes the problem much clearer to me now.
If we suppose that k=2 in the code, my understanding is that ind should beome [0,0] [0,1] [0,2] [1,1] [1,2] [2,2] in the loop is this correct? But i am still thinking about how to write the code to implement it. Thanks again. |
|
|||||
|
quite right
![]() and make this job in separate function or class method (it doesn't matter). For begin it's declaration may be looks like this: Code:
void fill_order(int n, double *p_a, int k, double *p_b); by k and p_b you know where to place results and size of array ind. That's enought for one order filling. Then, from outside you call this function/method for each 'order', passing the same n and p_a (in your example n=3, p_a - pointer to first element of array a=[a1 a2 a3]), and correcting k (incrementing) and p_d (should pointing to place of 'order' k in b array). That's simplest solution.
__________________
Sorry for my poor English
Last edited by vAC; 02-20-2008 at 06:21 AM. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP Code: Simple Encryption Algorithm | Void | PHP Tutorials | 11 | 11-05-2008 05:08 PM |
| Tutorial - A Simple Stropwatch! | travy92 | VB Tutorials | 17 | 10-26-2008 11:10 AM |
| Peterson's Algorithm | zm1723 | C# Programming | 1 | 12-13-2007 11:47 AM |
| Help : days algorithm | rivci | Java Help | 4 | 12-13-2007 05:57 AM |
| Algorithms - The Basics (PART 2) | TcM | Security Tutorials | 0 | 11-24-2007 11:33 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 98%