Click here to Skip to main content
15,895,557 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Programme to add given no of days to the current date to give the resulted date Pin
Richard MacCutchan9-Dec-10 22:35
mveRichard MacCutchan9-Dec-10 22:35 
GeneralRe: Programme to add given no of days to the current date to give the resulted date Pin
cmaheshwari1610-Dec-10 1:10
cmaheshwari1610-Dec-10 1:10 
GeneralRe: Programme to add given no of days to the current date to give the resulted date Pin
Richard MacCutchan10-Dec-10 2:44
mveRichard MacCutchan10-Dec-10 2:44 
QuestionHow to read the all Guids defined in abcd_i.c file from pdb Pin
glitteringsound6-Dec-10 23:09
glitteringsound6-Dec-10 23:09 
Questioni have a question about for_each Pin
lxlenovostar3-Dec-10 6:24
lxlenovostar3-Dec-10 6:24 
AnswerRe: i have a question about for_each Pin
Alain Rist3-Dec-10 23:30
Alain Rist3-Dec-10 23:30 
AnswerRe: i have a question about for_each Pin
xtofl6-Dec-10 4:18
xtofl6-Dec-10 4:18 
QuestionLinear Algebra with C++ Pin
VeganFanatic30-Nov-10 13:25
VeganFanatic30-Nov-10 13:25 
I have been working on a project for the last year and I have make much progress but much remains. First I will provide headers of what I have done so far.

template <class T> class vector;  // vector space
template <class T> class matrix;  // derived from vector
template <typename T> T norm(vector<T> v);
template <typename T> T norm(matrix<T> m);
template <typename T> void transpose(matrix<T> &m);
template <typename T> void conjugate_transpose(matrix<T> &m);
template <typename T> bool hermetian(matrix<T> &a, matrix<T> &b);
template <typename T> matrix<T> tensor_product(vector<T> row, vector<T> col);
template <typename T> matrix<T> minor(matrix<T> &source, int row, int col);
template <typename T> bool diagonal_dominant(matrix<T> a);
template <typename T> matrix<T> gauss_elimination(matrix<T> &m);
template <typename T> matrix<T> gauss_jordan(matrix<T> &m);
template <typename T> void gauss_siedel(matrix<T> a, vector<T> b, vector<T> x, double tolerance);


Now I can use vector<std::complex> and use it with math equations fine. Same for the matrix template.

So given my work to make these helpful templates, I am now out of my math book big time and into the realm of advanced linear algebra.

This is my Gauss elimination, and I was looking to leverage it to do LU decomposition etc to solve Ax = b more expediently.

template <typename T> matrix<T> gauss_elimination(matrix<T> &mat) {
	int i = 0; int j = 0; int maxi;
	matrix<T> a = mat;
	int m = (int)a.size();
	int n = (int)a[0].size();
	while ((i < m) && (j < n)) {
		maxi = i;
		// sweep down the column to find the pivot element
		for (int k = i + 1; k < m; k++) // partial pivoting
			if (std::abs(a[k][j]) > std::abs(a[maxi][j])) maxi = k;
		// eliminate
		if (a[maxi][j] != 0) {
			swap(a[i], a[maxi]); // row op 1, swap
			a[i] = a[i] / a[i][j];  // row op 2, scale the pivot to 1
			for (int u = i + 1; u < m; u++) 
				a[u] = a[u] - (a[i] * a[u][j]);  // row op 3, zero out the column below
			i++;
		}
		j++;
	}
	return a;
}


Suggestions?
http://www.contract-developer.tk

AnswerRe: Linear Algebra with C++ Pin
jean Davy15-Dec-10 11:06
jean Davy15-Dec-10 11:06 
QuestionHow to change active tab in tabbed MFC Pin
josip cagalj30-Nov-10 3:31
josip cagalj30-Nov-10 3:31 
QuestionQuestion about WTL CScrollImpl Pin
extremjoy29-Nov-10 21:34
extremjoy29-Nov-10 21:34 
AnswerRe: Question about WTL CScrollImpl Pin
Alain Rist29-Nov-10 22:34
Alain Rist29-Nov-10 22:34 
Questionhello, i have a question about char and int Pin
lxlenovostar29-Nov-10 0:22
lxlenovostar29-Nov-10 0:22 
AnswerRe: hello, i have a question about char and int Pin
Cool_Dev29-Nov-10 1:57
Cool_Dev29-Nov-10 1:57 
AnswerRe: hello, i have a question about char and int Pin
Richard MacCutchan29-Nov-10 3:40
mveRichard MacCutchan29-Nov-10 3:40 
Question[SOLVED] COM Dll Not Getting Registered In Windows Server 2008 [modified] Pin
MANISH RASTOGI26-Nov-10 18:20
MANISH RASTOGI26-Nov-10 18:20 
Questionrenaming files Pin
khomeyni20-Nov-10 7:46
khomeyni20-Nov-10 7:46 
AnswerRe: renaming files Pin
Cool_Dev20-Nov-10 21:12
Cool_Dev20-Nov-10 21:12 
GeneralRe: renaming files Pin
khomeyni20-Nov-10 23:48
khomeyni20-Nov-10 23:48 
GeneralRe: renaming files Pin
Richard MacCutchan21-Nov-10 1:15
mveRichard MacCutchan21-Nov-10 1:15 
GeneralRe: renaming files Pin
pasztorpisti2-Dec-10 6:11
pasztorpisti2-Dec-10 6:11 
AnswerRe: renaming files Pin
mbue9-Dec-10 15:28
mbue9-Dec-10 15:28 
GeneralRe: renaming files Pin
khomeyni10-Dec-10 4:26
khomeyni10-Dec-10 4:26 
QuestionHow to use WTL in dll? Pin
tank017-Nov-10 0:40
tank017-Nov-10 0:40 
AnswerRe: How to use WTL in dll? Pin
Alain Rist17-Nov-10 4:45
Alain Rist17-Nov-10 4:45 

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.