Click here to Skip to main content
15,914,481 members
Home / Discussions / Algorithms
   

Algorithms

 
Questionhelp me About Big O Pin
bosszy7-Dec-08 2:00
bosszy7-Dec-08 2:00 
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 
I am trying to implement Choleski's algorithm for a 5 by 5 matrix. When I run compare the results to Sci Lab, I find that my answer is different. Therefore, I am assuming that I am wrong. The code below is based on an algorithm given in the book "Numerical Analysis" by Burden, Faires
and Reynolds. Here is code:

void
Cholesky(double a[5][5], double l[5][5] )
{
	const int n = 5;
	l[0][0] = sqrt(a[0][0]);

	for( int j=2; j<=n; j++ )
		l[j-1][0] = a[j-1][0]/l[0][0];

	for( int i = 2 ; i<=(n-1); i++ ) {
		double sum = a[i-1][i-1];
		for( int k=1; k<=i-1; k++ )
			sum -= (l[i-1][k-1])*(l[i-1][k-1]);
		l[i-1][i-1] = sqrt(sum);

		for( int j = i+1; j<=n; j++ ) {
			double sum = a[j-1][i-1];
			for( int k = 1; k <= (i-1); k ++ )
				sum -= l[j-1][k-1] * l[i-1][k-1];
			l[j][i] = sum/l[i-1][i-1];
		}
	}

	double sum = a[n-1][n-1];
	for( int k = 1; k<=(n-1); k++ )
		sum -= l[n-1][k-1] * l[n-1][k-1];
	l[n-1][n-1] = sqrt(sum);
}


I am hoping that somebody can tell me where my problem is. Thanks.

Bob
AnswerRe: Choleski's Algorithm Pin
73Zeppelin6-Dec-08 6:36
73Zeppelin6-Dec-08 6:36 
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 

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.