Click here to Skip to main content
15,890,438 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: help me About Big O Pin
Luc Pattyn7-Dec-08 6:32
sitebuilderLuc Pattyn7-Dec-08 6:32 
AnswerRe: help me About Big O Pin
Paul Conrad9-Dec-08 11:37
professionalPaul Conrad9-Dec-08 11:37 
GeneralRe: help me About Big O Pin
Luc Pattyn9-Dec-08 13:13
sitebuilderLuc Pattyn9-Dec-08 13:13 
GeneralRe: help me About Big O Pin
Paul Conrad9-Dec-08 13:15
professionalPaul Conrad9-Dec-08 13:15 
AnswerRe: help me About Big O Pin
73Zeppelin10-Dec-08 18:51
73Zeppelin10-Dec-08 18:51 
AnswerRe: help me About Big O Pin
J. Andrew Smith6-Mar-09 3:16
J. Andrew Smith6-Mar-09 3:16 
QuestionCholeski's Algorithm Pin
BobInNJ6-Dec-08 6:06
BobInNJ6-Dec-08 6:06 
AnswerRe: Choleski's Algorithm Pin
73Zeppelin6-Dec-08 6:36
73Zeppelin6-Dec-08 6:36 
Hi Bob,

I think you should check your indices. I prefer the Numerical Recipes in C[^] version. See Chapter 2 Solution of Linear Algebraic Equations for other code. The Cholesky code for the Numerical Recipes routine is:


/* 
Given a positive-definite symmetric matrix a[1..n][1..n], this routine
  constructs its Cholesky decomposition, A = L · LT . On input, only the
  upper triangle of a need be given; it is not modified. The Cholesky
  factor L is returned in the lower triangle of a, except for its 
diagonal elements which are returned in p[1..n].
*/

#include <math.h>

void choldc(float **a, int n, float p[])
{
void nrerror(char error_text[]);
int i,j,k;
float sum;
for (i=1;i<=n;i++) {
    for (j=i;j<=n;j++) {
        for (sum=a[i][j],k=i-1;k>=1;k--) sum -= a[i][k]*a[j][k];
            if (i == j) {
                /*a, with rounding errors, is not positive definite.*/
                if (sum <= 0.0) 
                    nrerror("choldc failed");
                p[i]=sqrt(sum);
            } else a[j][i]=sum/p[i];
        }
    }
}
</math.h>


Try the NR code and see how it works.
GeneralRe: Choleski's Algorithm Pin
BobInNJ7-Dec-08 2:30
BobInNJ7-Dec-08 2:30 
GeneralRe: Choleski's Algorithm Pin
73Zeppelin8-Dec-08 22:40
73Zeppelin8-Dec-08 22:40 
GeneralRe: Choleski's Algorithm Pin
Luc Pattyn6-Dec-08 6:40
sitebuilderLuc Pattyn6-Dec-08 6:40 
QuestionClarke and Wright Algorithm Pin
Hemanth_k5-Dec-08 17:44
Hemanth_k5-Dec-08 17:44 
AnswerRe: Clarke and Wright Algorithm Pin
Robert.C.Cartaino6-Dec-08 4:52
Robert.C.Cartaino6-Dec-08 4:52 
Questionplz help me in writing an algorithm of the following problem Pin
IrfanHaleem30-Nov-08 10:22
IrfanHaleem30-Nov-08 10:22 
AnswerRe: plz help me in writing an algorithm of the following problem Pin
Member 419459330-Nov-08 10:54
Member 419459330-Nov-08 10:54 
GeneralRe: plz help me in writing an algorithm of the following problem Pin
IrfanHaleem30-Nov-08 10:57
IrfanHaleem30-Nov-08 10:57 
GeneralRe: plz help me in writing an algorithm of the following problem Pin
Luc Pattyn30-Nov-08 12:17
sitebuilderLuc Pattyn30-Nov-08 12:17 
GeneralRe: plz help me in writing an algorithm of the following problem Pin
Lutosław2-Dec-08 6:00
Lutosław2-Dec-08 6:00 
GeneralRe: plz help me in writing an algorithm of the following problem Pin
Paul Conrad2-Dec-08 6:55
professionalPaul Conrad2-Dec-08 6:55 
GeneralRe: plz help me in writing an algorithm of the following problem Pin
Lutosław2-Dec-08 8:04
Lutosław2-Dec-08 8:04 
GeneralRe: plz help me in writing an algorithm of the following problem Pin
Paul Conrad2-Dec-08 8:07
professionalPaul Conrad2-Dec-08 8:07 
AnswerRegarding requests to do homework questions. Pin
73Zeppelin30-Nov-08 23:26
73Zeppelin30-Nov-08 23:26 
GeneralRe: Regarding requests to do homework questions. Pin
Paul Conrad2-Dec-08 6:53
professionalPaul Conrad2-Dec-08 6:53 
AnswerRe: plz help me in writing an algorithm of the following problem Pin
Lutosław2-Dec-08 6:06
Lutosław2-Dec-08 6:06 
GeneralRe: plz help me in writing an algorithm of the following problem Pin
stevepqr11-Jan-09 21:53
stevepqr11-Jan-09 21:53 

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.