Conjugate transpose: Difference between revisions

m
C++ - changed formatting of output
m (→‎{{header|REXX}}: changed whitespace, aligned procedure/function statements)
m (C++ - changed formatting of output)
Line 407:
std::string to_string(const std::complex<scalar_type>& c) {
std::ostringstream out;
outconst <<int cprecision = 6;
out << std::fixed << std::setprecision(precision);
out << '(' << std::setw(precision + 3) << c.real() << ','
<< std::setw(precision + 3) << c.imag() << ')';
return out.str();
}
Line 414 ⟶ 417:
void print(std::ostream& out, const complex_matrix<scalar_type>& a) {
size_t rows = a.rows(), columns = a.columns();
std::vector<size_t> max_width(columns, 3);
for (size_t column = 0; column < columns; ++column) {
for (size_t row = 0; row < rows; ++row) {
max_width[column] = std::max(max_width[column],
to_string(a(row, column)).size());
}
}
for (size_t row = 0; row < rows; ++row) {
for (size_t column = 0; column < columns; ++column) {
if (column > 0)
out << ' ';
out << std::setwto_string(max_width[column]) << a(row, column));
}
out << '\n';
Line 516 ⟶ 512:
<pre>
Matrix:
( 2.000000, 0.000000) ( 2.000000, 1.000000) ( 4.000000, 0.000000)
( 2.000000,-1.000000) ( 3.000000, 0.000000) ( 0.000000, 1.000000)
( 4.000000, 0.000000) ( 0.000000,-1.000000) ( 1.000000, 0.000000)
Conjugate transpose:
( 2.000000,-0.000000) ( 2.000000, 1.000000) ( 4.000000,-0.000000)
( 2.000000,-1.000000) ( 3.000000,-0.000000) ( 0.000000, 1.000000)
( 4.000000,-0.000000) ( 0.000000,-1.000000) ( 1.000000,-0.000000)
Hermitian: true
Normal: true
Line 528 ⟶ 524:
 
Matrix:
( 0.707107, 0.000000) ( 0.707107, 0.000000) ( 0.000000, 0.000000)
( 0.000000,-0.707107) ( 0.000000, 0.707107) ( 0.000000, 0.000000)
( (0.000000, 0.000000) ( (0.000000, 0.000000) ( 0.000000, 1.000000)
Conjugate transpose:
( 0.707107,-0.000000) ( 0.000000, 0.707107) ( 0.000000,-0.000000)
( 0.707107,-0.000000) ( 0.000000,-0.707107) ( 0.000000,-0.000000)
( (0.000000,-0.000000) ( (0.000000,-0.000000) ( 0.000000,-1.000000)
Hermitian: false
Normal: true
Line 540 ⟶ 536:
 
Matrix:
( 2.000000, 2.000000) ( 3.000000, 1.000000) (-3.000000, 5.000000)
( 2.000000,-1.000000) ( 4.000000, 1.000000) ( 0.000000, 0.000000)
( 7.000000,-5.000000) ( 1.000000,-4.000000) ( 1.000000, 0.000000)
Conjugate transpose:
( 2.000000,-2.000000) ( 2.000000, 1.000000) ( 7.000000, 5.000000)
( 3.000000,-1.000000) ( 4.000000,-1.000000) ( 1.000000, 4.000000)
(-3.000000,-5.000000) ( 0.000000,-0.000000) ( 1.000000,-0.000000)
Hermitian: false
Normal: false
1,777

edits