Beispiel #1
0
int SchreyerOrder::schreyer_compare_encoded(const int *m,
                                            int m_comp,
                                            const int *n,
                                            int n_comp) const
{
  int cmp = M->compare(m,n);
  if (cmp != EQ) return cmp;
  cmp = compare_num(m_comp) - compare_num(n_comp);
  if (cmp < 0) return LT;
  if (cmp > 0) return GT;
  return EQ;
}
Beispiel #2
0
SchreyerOrder *SchreyerOrder::copy() const
{
  SchreyerOrder *result = new SchreyerOrder(M);
  for (int i=0; i<rank(); i++)
    result->append(compare_num(i), base_monom(i));
  return result;
}
Beispiel #3
0
int SchreyerOrder::schreyer_compare(const int *m,
                                    int m_comp,
                                    const int *n,
                                    int n_comp) const
{
  const int *ms = base_monom(m_comp);
  const int *ns = base_monom(n_comp);
  for (int i=M->monomial_size(); i>0; --i)
    {
      int cmp = *ms++ + *m++ - *ns++ - *n++;
      if (cmp < 0) return LT;
      if (cmp > 0) return GT;
    }
  int cmp = compare_num(m_comp) - compare_num(n_comp);
  if (cmp < 0) return LT;
  if (cmp > 0) return GT;
  return EQ;
}
Beispiel #4
0
void SchreyerOrder::text_out(buffer &o) const
{
  for (int i=0; i<_rank; i++)
    {
      if (i != 0) o << ' ';
      M->elem_text_out(o, base_monom(i));
      o << '.';
      o << compare_num(i);
    }
}
Beispiel #5
0
SchreyerOrder *SchreyerOrder::sub_space(int n) const
{
  if (n < 0 || n > rank())
    {
      ERROR("sub schreyer order: index out of bounds");
      return NULL;
    }
  SchreyerOrder *result = new SchreyerOrder(M);
  for (int i=0; i<n; i++)
    result->append(compare_num(i), base_monom(i));
  return result;
}
Beispiel #6
0
bool SchreyerOrder::is_equal(const SchreyerOrder *G) const
// A schreyer order is never equal to a non-Schreyer order, even
// if the monomials are all ones.
{
  if (G == NULL) return false;
  for (int i=0; i<rank(); i++)
    {
      if (compare_num(i) != G->compare_num(i))
        return false;
      if (M->compare(base_monom(i), G->base_monom(i)) != 0)
        return false;
    }
  return true;
}
Beispiel #7
0
SchreyerOrder *SchreyerOrder::sub_space(M2_arrayint a) const
{
  // Since this is called only from FreeModule::sub_space,
  // the elements of 'a' are all in bounds, and do not need to be checked...
  // BUT, we check anyway...
  SchreyerOrder *result = new SchreyerOrder(M);
  for (unsigned int i=0; i<a->len; i++)
    if (a->array[i] >= 0 && a->array[i] < rank())
      result->append(compare_num(a->array[i]), base_monom(a->array[i]));
    else
      {
        ERROR("schreyer order subspace: index out of bounds");
        deleteitem(result);
        return NULL;
      }
  return result;
}
Beispiel #8
0
/// 根据输入的关键字,返回满足条件的所有记录条数 
static S32 my_search_func(U8 *keyword)
{
	S32 i;
	S8 *p;
	S32 ok_counts = 0;
	S8 tmp[256];
	S32 filter_index = 0;
	U8 num_ascii[MAX_PB_NUMBER_LENGTH + 1 + 1];
	S16 store_index;
	S32 item_index;


	mmi_ucs2_to_asc((S8 *)tmp, (S8 *) keyword);
        if(strlen(tmp) == 0)
            return 0;
#if 1
	for (i = 0;  i < /*PhoneBookEntryCount */ total_items; i++)
	{
#if 0//(NEW_DIAL_SCREEN)
		// 用户输入
		if (i == FIRST_USER_INPUT_INDEX)
		{
			list_filter_index_array[filter_index++] = -1;
			ok_counts++;
			
			continue;
		}
#endif
		// 电话本处理
		store_index =   g_phb_name_index[i];//[i - 1];//(NEW_DIAL_SCREEN)
                /* BEGIN: zouxuebin modify for Bug #13623 09-07-23 */
                if(((PhoneBook[store_index].tel.type & 0x90) == 0x90) && (PhoneBook[store_index].tel.type != 0xFF))
                {
                    num_ascii[0] = '+';
                    //mmi_phb_convert_to_digit_by_storage(num_ascii + 1, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1, MMI_NVRAM);
                    mmi_phb_convert_to_digit(num_ascii + 1, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1);

                }
                else
                {
                    //mmi_phb_convert_to_digit_by_storage(num_ascii, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1, MMI_NVRAM);
                    mmi_phb_convert_to_digit(num_ascii, PhoneBook[store_index].tel.number, MAX_PB_NUMBER_LENGTH + 1);

				}
                /* END: zouxuebin modify */
		if (compare_num((S8 *)num_ascii, (S8 *)tmp))
		{
			ok_counts++;
			list_filter_index_array[filter_index++] = i;//i - 1;	// modified by qinjiangwei 2008/6/6//(NEW_DIAL_SCREEN)
		}
	}

#else
	
	for (i = 0; i < MAX_LIST_ITEM_COUNT; i++)
	{
		p = get_num_ptr(list_cell_text_array[i]);
		if (!p)
		{
			continue;
		}

		if (compare_num(p, tmp))
		{
			ok_counts++;
			list_filter_index_array[filter_index++] = i;
		}
	}
#endif	

#ifdef WIN32
	_RPT1( _CRT_WARN, "ok_counts = %d\n", ok_counts);
#endif
	memset(CallBuffer, 0, sizeof(CallBuffer));
	
	return ok_counts;
}