Exemplo n.º 1
0
 void check() { 
#ifndef PRINT_ALL
  std::cerr  << "det = " << D.determinant() <<  " == " << std::complex<double>(determinant(D.matrix()))<< std::endl;
#else
  std::cerr  << "det = " << D.determinant() <<  " == " << std::complex<double>(determinant(D.matrix()))<< std::endl <<
   D.inverse_matrix() << D.matrix() << triqs::arrays::matrix<std::complex<double>>(inverse(D.matrix()))<<  std::endl;
  std::cerr << "det_old = " << det_old << "detratio = "<< detratio<< " determin "<< D.determinant() <<std::endl;
#endif
  assert_close(D.determinant() , long(1)/determinant(D.inverse_matrix()), PRECISION); 
  triqs::arrays::assert_all_close( inverse(D.matrix()) , D.inverse_matrix(), PRECISION, true);
  assert_close( det_old * detratio , D.determinant(), PRECISION);
 }
Exemplo n.º 2
0
/** Multiplies a Translate with a Rotate.
 \return a Matrix which not only Translates by the Rotated translation, but also includes the rotation.
 */
Matrix operator*(Translate const &t, Rotate const &r) {
    Matrix ret(r);
    ret.set_translation(t.offset * ret);

    assert_close( ret, Matrix(t) * Matrix(r) );
    return ret;
}
Exemplo n.º 3
0
/** Multiplies a Scale with a Translate.
 \return a Matrix which Scales, and then Translates.
 */
Matrix operator*(Scale const &s, Translate const &t) {
    Matrix ret(s);
    ret.set_translation(t.offset);

    assert_close( ret, Matrix(s) * t );
    return ret;
}
Exemplo n.º 4
0
/** Multiplies a Translate with a Scale.
 \return a Matrix which not only Translates by the Scaled translation, but also includes the scaling.
 */
Matrix operator*(Translate const &t, Scale const &s) {
    Matrix ret(s);
    ret[4] = t[X] * s[X];
    ret[5] = t[Y] * s[Y];

    assert_close( ret, Matrix(t) * Matrix(s) );
    return ret;
}
Exemplo n.º 5
0
/** Multiplies a Matrix with a translation, effectively adding the translation to the matrix. */
Matrix operator*(Matrix const &m, Translate const &t) {
    Matrix ret(m);
    ret[4] += t[X];
    ret[5] += t[Y];

    assert_close( ret, m * Matrix(t) );
    return ret;
}
Exemplo n.º 6
0
/** Multiplies a Scale with a Matrix.
 \return a Matrix where the x and y axii have been Scaled.
 */
Matrix operator*(Scale const &s, Matrix const &m) {
    Matrix ret(m);
    ret[0] *= s[X];
    ret[1] *= s[X];
    ret[2] *= s[Y];
    ret[3] *= s[Y];

    assert_close( ret, Matrix(s) * m );
    return ret;
}
Exemplo n.º 7
0
/** Divides a Matrix by a Scale.  This is the same thing as multiplying by the inverse of the Scale. */
Matrix operator/(Matrix const &m, Scale const &s) {
    Geom::Matrix ret(m);
    ret[0] /= s[X];
    ret[1] /= s[Y];
    ret[2] /= s[X];
    ret[3] /= s[Y];
    ret[4] /= s[X];
    ret[5] /= s[Y];

    assert_close( ret, m * Matrix(s.inverse()) );
    return ret;
}
Exemplo n.º 8
0
/** Multiplies a Matrix with a Scale, scaling up every aspect of the transformation. */
Matrix operator*(Matrix const &m, Scale const &s) {
    Matrix ret(m);
    ret[0] *= s[X];
    ret[1] *= s[Y];
    ret[2] *= s[X];
    ret[3] *= s[Y];
    ret[4] *= s[X];
    ret[5] *= s[Y];

    assert_close( ret, m * Matrix(s) );
    return ret;
}