need help with vector multiplication
"Uli Stein" <[email protected]> Wed, 19 May 2004 13:11:23 +0200 (MEST)
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all!
Something is going wrong in the following simple peace of code. I tried to
keep it as simple as possible. Could someone please tell me what I'm doing
wrong:
<SCHNIP>
/********* TYPEDEFS *************************/
typedef matrix<double,
rectangle<>,
dense<external>,
column_major >::type extMatrix; //typedef for state space
//matrices and vectors,
using
//"external data
constructors"
typedef matrix<double,
rectangle<>,
dense<>,
column_major >::type intMatrix; //"internal data
constructors"
/********* EXTERNAL DATA DECLARATION ********/
double m_in1[3];
double m_in2[3];
double *m_c_array;
// for example
m_in1[0] = 1;
m_in1[1] = 1;
m_in1[2] = 1;
m_in2[0] = 0;
m_in2[1] = 0;
m_in2[2] = 0;
m_c_array[0] = 0;
m_c_array[1] = 0;
m_c_array[2] = 1;
/********* CODESAMPLE ***********************/
double temp_array[]={0,0,0};
extMatrix temp_vec(temp_array,M3,M1);
extMatrix m_c_vec(m_c_array,M1,M3);
intMatrix result_vec(M1,M1);
// 1st COPY //
CopyVector(temp_array, m_in1, 3);
mult(m_c_vec, temp_vec, result_vec); //<-- 'result_vec' has correct result
m_result1 = result_vec(0,0);
std::cout << "m_result1= " << m_result1 << ", size: ";
print_all_matrix(result_vec);
// 2nd COPY //
CopyVector(temp_array, m_in2, 3);
mult(m_c_vec, temp_vec, result_vec); //<-- now, 'result_vec' hast the
// same result as in the the
// "1st COPY" ?!
m_result2 = result_vec(0,0);
std::cout << "m_result2= " << m_result2 << ", size: ";
print_all_matrix(result_vec);
<SCHNAP>
I thought, that I used the MTL function 'CopyVector()' and 'mult()'
correctly (I'm working on MSVC++ 6.0). It seems, that the 'IntMatrix
result_vec' is not updated correctly by 'mult()'?!
I would be very grateful, if someone could show me where I made some
mistakes. Probably they are of basic nature.
Thanks a lot! Regards,
Uli
--
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info
_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/