Example #1
0
ring_elem SchurRing::mult_monomials(const int *m, const int *n)
{
  int i;

  exponents a_part = ALLOCATE_EXPONENTS(sizeof(int) * (nvars_ + 1));
  exponents b_part = ALLOCATE_EXPONENTS(sizeof(int) * (nvars_ + 1));
  exponents lambda = ALLOCATE_EXPONENTS(2 * sizeof(int) * (nvars_ + 1));
  exponents p = ALLOCATE_EXPONENTS(2 * sizeof(int) * (nvars_ + 1));

  // First: obtain the partitions
  to_partition(m, a_part);
  to_partition(n, b_part);

  // Second: make the skew partition
  int a = b_part[1];
  for (i=1; i <= nvars_ && a_part[i] != 0; i++)
    {
      p[i] = a + a_part[i];
      lambda[i] = a;
    }
  int top = i-1;
  for (i=1; i <= nvars_ && b_part[i] != 0; i++)
    {
      p[top+i] = b_part[i];
      lambda[top+i] = 0;
    }
  p[top+i] = 0;
  lambda[top+i] = 0;

  // Call the SM() algorithm
  return skew_schur(lambda, p);
}
Example #2
0
File: schur2.cpp Project: pzinn/M2
ring_elem SchurRing2::mult_terms(const_schur_partition a, const_schur_partition b)
{
  int maxsize = (a[0] - 1 + b[0] - 1) + 1; // this is the max number of elements in the output partition, plus one

  schur_partition lambda = ALLOCATE_EXPONENTS(sizeof(schur_word) * maxsize);
  schur_partition p = ALLOCATE_EXPONENTS(sizeof(schur_word) * maxsize);

  // Second: make the skew partition (note: r,s>=1)
  // this is: if a = r+1 a1 a2 ... ar
  //             b = s+1 b1 b2 ... bs
  // p is:
  //   (r+s+1) b1+a1 b1+a2 ... b1+ar b1 b2 ... bs
  // lambda is:
  //   (r+1)   b1    b1    ... b1    0  0  ... 0

  int r = a[0]-1;
  int s = b[0]-1;
  int c = b[1];

  assert(r+s+1 == maxsize);
  
  for (int i=1; i<=r; i++)
    {
      assert(i < maxsize);
      p[i] = c + a[i];
      lambda[i] = c;
    }
  for (int i=r+1; i<r+s+1; i++)
    {
      assert(i < maxsize);      
      p[i] = b[i-r];
      lambda[i] = 0;
    }
  p[0] = r+s+1;
  lambda[0] = r+1;
  return skew_schur(lambda, p);
}