Exemplo n.º 1
0
void TailGF::invert() {
  const int omin(OrderMin()), omax(OrderMax());
  if (N1!=N2) TRIQS_RUNTIME_ERROR<<"Inversion can only be done for square matrix !";
  int new_OrderMin = - omin;
  if (new_OrderMin <OrderMinMIN) TRIQS_RUNTIME_ERROR<<" I can not inverse with the OrderMinMIN and OrderMaxMAX provided";
  int new_OrderMax = min(OrderMaxMAX,omax - omin + new_OrderMin);

  Array<COMPLEX,3> newM(Range(OrderMinMIN, OrderMaxMAX),Range(0,N1-1),Range(0,N2-1)); //new_OrderMax - new_OrderMin +1,N1,N2);
  newM=0;

  Array<COMPLEX,2> tmp(N1,N2,fortranArray),S(N1,N2,fortranArray);
  Array<COMPLEX,2> M0( newM(new_OrderMin,ALL,ALL));
  M0 = M(omin,ALL,ALL); 
  if (!Inverse_Matrix(M0)) TRIQS_RUNTIME_ERROR<<"TailGF::invert : This tail is 0  !!!";

  // b_n = - a_0^{-1} * sum_{p=0}^{n-1} b_p a_{n-p} for n>0
  // b_0 = a_0^{-1}
  for (int n = 1; n<=new_OrderMax-new_OrderMin; ++n) {
    S = 0;
    for (int p=0; p<n;p++) {
      matmul_lapack(newM(new_OrderMin + p,ALL,ALL),M(omin+ n-p ,ALL,ALL),tmp);
      S +=tmp;
    }
    matmul_lapack(M0,S,tmp);
    newM(n+new_OrderMin,ALL,ALL) = -tmp;
  }
  M= newM;
  OrderMaxArray = new_OrderMax;
}
Exemplo n.º 2
0
// generate the world matrix for a given set of angles and origin - called from lots of places
void G2_GenerateWorldMatrix(const vec3_t angles, const vec3_t origin)
{
	Create_Matrix(angles, &worldMatrix);
	worldMatrix.matrix[0][3] = origin[0];
	worldMatrix.matrix[1][3] = origin[1];
	worldMatrix.matrix[2][3] = origin[2];

	Inverse_Matrix(&worldMatrix, &worldMatrixInv);
}