![]() |
| | #1 |
| Registered User Join Date: Nov 2009
Posts: 8
| pseudo code to c++ matrix row reduction Input the n x n matrix A and n element vector b for k = 1 to n for i = k + 1 to n lik aik=akk for j = k + 1 to n aij to aij - likakj end for end for end for |
| eholbro1 is offline | |
| | #2 |
| Registered User Join Date: Apr 2006
Posts: 1,193
| What exactly is your trouble with it? And what's l in the psudo code?
__________________ It is too clear and so it is hard to see. A dunce once searched for fire with a lighted lantern. Had he known what fire was, He could have cooked his rice much sooner. |
| King Mir is offline | |
| | #3 |
| Registered User Join Date: Nov 2009
Posts: 8
| IDK, the professor for my linear algebra class decided to give us this code to see if we could convert it to c++ this is what I came up with.. Code: #include <iostream>
using namespace std;
int main()
{
int i;
int m;
int n;
cout<<"Input Matrix Size: ";
cin>>i;
cout<<"Input number of rows: ";
cin>>m;
cout<<"Input number of columns: ";
cin>>n;
for(m=1; n-1)
cout<<b(m)-0
for(n-1; N-1)
cout<<a(m,n)=0
end;
for(a(m,m+1)
cout<<-1
for(a(m,m)
cout<<=2
for(a(m+1,)
cout<<=-1
end;
system("pause");
return 0;
}
|
| eholbro1 is offline | |
| | #4 |
| Registered User Join Date: Apr 2006
Posts: 1,193
| Using a compiler and a C++ book on hand might help. There are too many errors in that to make it worth the time of anyone here to itemize, particularly since you are liable to make more errors correcting.
__________________ It is too clear and so it is hard to see. A dunce once searched for fire with a lighted lantern. Had he known what fire was, He could have cooked his rice much sooner. |
| King Mir is offline | |
| | #5 | |
| Algorithm Dissector Join Date: Dec 2005 Location: New Zealand
Posts: 2,476
| Quote:
You can't use this forum to get you there, you need another source to learn from first. So many people don't seem to get that there is no shortcut in learning to program. "Do or do not; there is no try".
__________________ My homepage Advice: Take only as directed - If symptoms persist, please see your debugger | |
| iMalc is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C - access violation | uber | C Programming | 2 | 07-08-2009 01:30 PM |
| Matrix Help | HelpmeMark | C++ Programming | 27 | 03-06-2008 05:57 PM |
| matrix class | shuo | C++ Programming | 2 | 07-13-2007 01:03 AM |
| Trying to make this code faster & Cramer | just2peachy | C++ Programming | 3 | 12-03-2004 10:54 AM |
| What is a matrix's purpose in OpenGL | jimboob | Game Programming | 5 | 11-14-2004 12:19 AM |