69 lines
2.9 KiB
C++
69 lines
2.9 KiB
C++
#include "pip.h"
|
|
|
|
|
|
int main() {
|
|
// PIMathMatrix<complexd> m1(2,2, PIVector<complexd>() << complexd(1.) << complexd(1.) << complexd(0.) << complexd(1.));
|
|
// PIMathMatrix<complexd> m2(2,3, PIVector<complexd>() << complexd(2., 3.) << complexd(2., 3.) << complexd(2., 3.) << complexd(2., 3.) << complexd(2., 3.) << complexd(2., 3.));
|
|
PIMathMatrix<double> m1(3,3, PIVector<double>() << 1. << 2. << 3. << 4. << 6. << 5. << 9. << 8. << 7.);
|
|
// PIMathMatrix<double> m2(2,3, PIVector<double>() << 1. << 2. << complexd(2., 3.) << complexd(2., 3.) << complexd(2., 3.) << complexd(2., 3.));
|
|
// PIMathMatrix<double> m3(vv);
|
|
// piCout << m2 << PICoutManipulators::NewLine;
|
|
// piCout << (PIVector2D<complexd>)m2 << PICoutManipulators::NewLine;
|
|
// for (uint r = 0; r < m2.rows(); ++r) {
|
|
// for (uint c = 0; c < m2.cols(); ++c) {
|
|
//// piCout << m2[r][c];
|
|
// m2[r][c] = complexd(m2[r][c].real(), -(m2[r][c].imag()));
|
|
//// m2[r][c] = complexd();
|
|
|
|
// }
|
|
// }
|
|
piCout << m1 << PICoutManipulators::NewLine;
|
|
// piCout << m2 << PICoutManipulators::NewLine;
|
|
// piCout << (PIVector2D<complexd>)m2 << PICoutManipulators::NewLine;
|
|
// piCout << m2.transposed() << PICoutManipulators::NewLine;
|
|
// piCout << hermitian(m2) << PICoutManipulators::NewLine;
|
|
// piCout << (m2*m1);
|
|
// PIMathVector<complexd> v(PIVector<complexd>() << complexd(1.) << complexd(2.));
|
|
// piCout << (m1*PIMathMatrix<complexd>::matrixCol(v));```
|
|
// piCout << m2;
|
|
// piCout << m3;
|
|
bool ok;
|
|
PIMathMatrix<double> mi = m1.inverted(&ok);
|
|
piCout << mi << ok;
|
|
piCout << (mi * m1);
|
|
piCout << m1.row(0).toVector();
|
|
piCout << m1.row(1).toVector();
|
|
piCout << m1.row(2).toVector();
|
|
piCout << "";
|
|
piCout << m1.col(0).toVector();
|
|
piCout << m1.col(1).toVector();
|
|
piCout << m1.col(2).toVector();
|
|
//m2 = m2.transposed();
|
|
// piCout << m2 << PICoutManipulators::NewLine << hermitian(m2);
|
|
// piCout << PICoutManipulators::NewLine << hermitian(m2) * mi;
|
|
// piCout << PICoutManipulators::NewLine << m1 * m2 << PICoutManipulators::NewLine << m2 * m1;
|
|
// piCout << PICoutManipulators::NewLine << hermitian(m1*m2) << PICoutManipulators::NewLine << hermitian(m2) * hermitian(m1);
|
|
// PIVector2D<double> v(3,2);
|
|
// for (uint r = 0; r < v.rows(); ++r) {
|
|
// for (uint c = 0; c < v.cols(); ++c) {
|
|
// piCout << r*v.cols()+c+1;
|
|
// v[r][c] = r*v.cols()+c+1;
|
|
// }
|
|
// }
|
|
// piCout << v;
|
|
// for (uint c = 0; c < v.cols(); ++c) {
|
|
// for (uint r = 0; r < v.rows(); ++r) {
|
|
// piCout << r*v.cols()+c+1;
|
|
// v[r][c] = -v[r][c];
|
|
// }
|
|
// }
|
|
PIMathMatrix<double> v = PIMathMatrix<double>(3,2, m1.toPlainVector().resize(6));
|
|
PIMathMatrix<double> v2 = PIMathMatrix<double>(2,3, m1.toPlainVector().resize(6));
|
|
piCout << v << PICoutManipulators::NewLine;
|
|
piCout << v.toVectors() << PICoutManipulators::NewLine;
|
|
// PIMathMatrix<double> v2 = PIMathMatrix<double>(v.toVectors());
|
|
piCout << v2 << PICoutManipulators::NewLine;
|
|
piCout << v*v2 << PICoutManipulators::NewLine;
|
|
return 0;
|
|
}
|