Exemple #1
0
static int PrimitiveRotMx(const int *CCMx_LP, int *RotMx, const int *CCMx_PL,
                          int deterCCMx_LP)
{
  int       i;
  int       BufMx[9];


  /* Mp = Tlp . Mz . Tpl */

  RotMxMultiply(BufMx, RotMx, CCMx_PL);
  RotMxMultiply(RotMx, CCMx_LP, BufMx);

  for (i = 0; i < 9; i++)
  {
    if (RotMx[i] % deterCCMx_LP) {
      SetSgError("Internal Error: PrimitiveRotMx()");
      return -1;
    }
  }

  for (i = 0; i < 9; i++)
    RotMx[i] /= deterCCMx_LP;

  return 0;
}
Exemple #2
0
int MakeCumRMx(const int *R, int Order, int *CumRMx)
{
  int  MxA[9], MxB[9];
  int  *RR, *RRR, *Swp, iO, i;


  if (Order < 0) {
    Order *= -1;
    if (Order % 2) Order *= 2;
  }

  InitRotMx(CumRMx, 1);

  if (Order > 1)
  {
    RR = (int *) R;
    RRR = MxA;

    for (iO = 1;;)
    {
      for (i = 0; i < 9; i++) CumRMx[i] += RR[i];

      if (++iO == Order)
        break;

      RotMxMultiply(RRR, R, RR);
      if (RR == R) RR = MxB;
      Swp = RR; RR = RRR; RRR = Swp;
    }
  }

  return Order;
}
Exemple #3
0
static int SetBasis(const int ProperR[9], int AbsOrder, int CumMx[9],
                    int Basis[3][3])
{
  int        i, j;
  int        RmI[9], MbvBuf[9];
  const int  *Mbv;


  if (AbsOrder == 1)
  {
    for (i = 0; i < 3; i++)
      for (j = 0; j < 3; j++)
        Basis[i][j] = (i == j ? 1 : 0);

    return 0;
  }

  SetRminusI(ProperR, RmI, 0);
  if (iReducedRowEchelon(RmI, 3, 3, NULL, 1) != 2) return -1;
  if (RRE2EigenVector(RmI, Basis[2]) != 0) return -1;

  if (iReducedRowEchelon(CumMx, 3, 3, NULL, 1) != 1) return -1;

  Mbv = NULL;

  if (AbsOrder > 2)
  {
    if (AbsOrder > 4) {
      RotMxMultiply(MbvBuf, ProperR, ProperR);
      Mbv = MbvBuf;
    }
    else
      Mbv = ProperR;
  }

  RRE1BVAB(CumMx, Basis[2], Basis[0], Basis[1], Mbv);

  if (deterRotMx((int *) Basis) < 1) {
    SetSgError("Internal Error: SetBasis(): Det < 1");
    return -1;
  }

  return 0;
}
Exemple #4
0
static int VerifyRotMxOrder(const int *ProperR, int AbsOrder, int *CumMx)
{
  int  MxA[9], MxB[9];
  int  *RR, *RRR, *Swp, iO, i;

  const int IdentityMx[] = { 1, 0, 0,
                             0, 1, 0,
                             0, 0, 1 };


  if (CumMx) for (i = 0; i < 9; i++) CumMx[i] = ProperR[i];

  RR = (int *) ProperR;
  RRR = MxA;

  for (iO = 1; iO < AbsOrder; iO++)
  {
    for (i = 0; i < 9; i++)
      if (-1 > RR[i] || RR[i] > 1)
        return -1;

    if (MemCmp(IdentityMx, RR, 9) == 0)
      return -1;

    RotMxMultiply(RRR, ProperR, RR);
    if (RR == ProperR) RR = MxB;
    Swp = RR; RR = RRR; RRR = Swp;

    if (CumMx) for (i = 0; i < 9; i++) CumMx[i] += RR[i];
  }

  if (MemCmp(IdentityMx, RR, 9) != 0)
    return -1;

  return 0;
}