Click here to Skip to main content
15,919,931 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Get a polygons from edges Pin
furqan_sindhu9-Nov-08 19:01
furqan_sindhu9-Nov-08 19:01 
GeneralRe: Get a polygons from edges Pin
Member 419459310-Nov-08 3:08
Member 419459310-Nov-08 3:08 
GeneralRe: Get a polygons from edges Pin
furqan_sindhu9-Nov-08 18:56
furqan_sindhu9-Nov-08 18:56 
AnswerRe: Get a polygons from edges Pin
darrellp28-Nov-08 19:38
darrellp28-Nov-08 19:38 
QuestionRandom Number Generation Pin
BobInNJ5-Nov-08 13:47
BobInNJ5-Nov-08 13:47 
AnswerRe: Random Number Generation Pin
73Zeppelin5-Nov-08 21:36
73Zeppelin5-Nov-08 21:36 
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 6:29
BobInNJ6-Nov-08 6:29 
GeneralRe: Random Number Generation Pin
73Zeppelin6-Nov-08 8:28
73Zeppelin6-Nov-08 8:28 
Cholesky decomposition and eigenvector decomposition will give you the same result for this problem. Since Cholesky is easier to implement, I'd suggest using that method.

The method is just a matrix form of the calculation I described above.

We want U'U = C where C is the correlation matrix. So, assemble your correlation matrix and apply Cholesky decomposition to it. This gives you U. Generate, say, 5 series of random variates of 100 observations. Assemble those 5 column matrices into a large matrix so that the dimension of N is 100x5. This means the correlation matrix has to be 5x5 and contains your known/desired cross-correlations. The 5 correlated series are simply N*U. All done!

Eigenvector decomposition proceeds in a similar fashion but is more complicated to implement. Given the correlation matrix, C, you calculate its eigenvectors and eigenvalues (standard linear algebra). If the eigenvectors are E_i and the eigenvalues are L_i, where i is a subscript, then we calculate a matrix V such that:

V = E_i*diag(sqrt(L_i))

where diag is a diagonal matrix with L_i on the diagonal. Because of it's construction matrix V will have the property that: V'V = C, C being the correlation matrix. Then, as above we have U'U = C where, conveniently (ha!) U = V'.

Nifty, but a roundabout route and used mainly for matrices that have problems being decomposed via Cholesky. Now our correlated random numbers, R_c are just:

R_c = R*U where R is the matrix of original random numbers.
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 9:56
BobInNJ6-Nov-08 9:56 
GeneralRe: Random Number Generation Pin
73Zeppelin6-Nov-08 10:21
73Zeppelin6-Nov-08 10:21 
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 12:51
BobInNJ6-Nov-08 12:51 
GeneralRe: Random Number Generation [modified] Pin
73Zeppelin6-Nov-08 20:50
73Zeppelin6-Nov-08 20:50 
QuestionRecords and Clusters [modified] Pin
DQNOK5-Nov-08 4:40
professionalDQNOK5-Nov-08 4:40 
AnswerRe: Records and Clusters Pin
Member 41945935-Nov-08 6:28
Member 41945935-Nov-08 6:28 
GeneralRe: Records and Clusters Pin
DQNOK5-Nov-08 6:56
professionalDQNOK5-Nov-08 6:56 
GeneralRe: Records and Clusters Pin
Member 41945935-Nov-08 7:44
Member 41945935-Nov-08 7:44 
GeneralRe: Records and Clusters Pin
DQNOK6-Nov-08 4:54
professionalDQNOK6-Nov-08 4:54 
GeneralRe: Records and Clusters Pin
Member 41945936-Nov-08 7:57
Member 41945936-Nov-08 7:57 
GeneralRe: Records and Clusters Pin
Member 419459325-Apr-09 4:28
Member 419459325-Apr-09 4:28 
GeneralRe: Records and Clusters Pin
DQNOK27-Apr-09 3:13
professionalDQNOK27-Apr-09 3:13 
GeneralRe: Records and Clusters Pin
DQNOK27-Apr-09 5:57
professionalDQNOK27-Apr-09 5:57 
GeneralRe: Records and Clusters Pin
Member 419459327-Apr-09 11:22
Member 419459327-Apr-09 11:22 
QuestionRePosted from C# Forums: A Job Exam Question Pin
Bulky Fellow4-Nov-08 20:31
Bulky Fellow4-Nov-08 20:31 
AnswerRe: RePosted from C# Forums: A Job Exam Question Pin
Arash Partow4-Nov-08 21:59
Arash Partow4-Nov-08 21:59 
AnswerRe: RePosted from C# Forums: A Job Exam Question Pin
Mark Churchill5-Nov-08 1:46
Mark Churchill5-Nov-08 1:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.