Changeset 50d54f8 in git for kernel/syz1.cc


Ignore:
Timestamp:
Feb 16, 2007, 11:54:07 AM (17 years ago)
Author:
Motsak Oleksandr <motsak@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
ab5a00e48ad4cc3712a383f8bac8092901c04e7f
Parents:
315ec157e2720c25cd94ca1aaa9d44b32f206ea3
Message:
*motsak: +'lres' for weighted modules


git-svn-id: file:///usr/local/Singular/svn/trunk@9865 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/syz1.cc

    r315ec1 r50d54f8  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz1.cc,v 1.11 2006-11-24 12:18:28 Singular Exp $ */
     4/* $Id: syz1.cc,v 1.12 2007-02-16 10:54:07 motsak Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    26102610}
    26112611
     2612
     2613
     2614/*2
     2615* more general implementation of LaScala's algorithm
     2616* assumes that the given module is (quasi-)homogeneous
     2617* works with slanted degree, uses syChosePairs
     2618*/
     2619syStrategy syLaScala(ideal arg, int& maxlength, intvec* weights)
     2620{
     2621  BOOLEAN noPair=FALSE;
     2622  int i,j,actdeg=32000,index=0,reg=-1;
     2623  int startdeg,howmuch;
     2624  poly p;
     2625  ideal temp;
     2626  SSet nextPairs;
     2627  syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
     2628  ring origR = currRing;
     2629
     2630  if(weights!= NULL)
     2631    syzstr->cw = new intvec(weights);
     2632  else
     2633    syzstr->cw = NULL;
     2634
     2635  if ((idIs0(arg)) ||
     2636      ((idRankFreeModule(arg)>0) && (!idTestHomModule(arg, NULL, syzstr->cw))))
     2637  {
     2638    syzstr->minres = (resolvente)omAlloc0Bin(ideal_bin);
     2639    syzstr->length = 1;
     2640    syzstr->minres[0] = idInit(1,arg->rank);
     2641    return syzstr;
     2642  }
     2643
     2644
     2645  //crit = 0;
     2646  //euler = -1;
     2647  redpol = pInit();
     2648 
     2649  if( maxlength > 0 )
     2650    syzstr->length = maxlength; //  = pVariables+2;
     2651  else
     2652    syzstr->length = maxlength = pVariables+2; 
     2653
     2654  // Creare dp,S ring and change to it
     2655  syzstr->syRing = rCurrRingAssure_dp_S();
     2656  assume(syzstr->syRing != origR);
     2657
     2658  // set initial ShiftedComps
     2659  currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
     2660  currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
     2661  for (i=0;i<=arg->rank;i++)
     2662  {
     2663    currShiftedComponents[i] = (i)*SYZ_SHIFT_BASE;
     2664    currcomponents[i] = i;
     2665  }
     2666  rChangeSComps(currcomponents, currShiftedComponents, arg->rank);
     2667/*--- initializes the data structures---------------*/
     2668  syzstr->Tl = new intvec(maxlength);
     2669  temp = idInit(IDELEMS(arg),arg->rank);
     2670  for (i=0;i<IDELEMS(arg);i++)
     2671  {
     2672    temp->m[i] = prCopyR( arg->m[i], origR);
     2673    if (temp->m[i]!=NULL)
     2674    {
     2675      j = pTotaldegree(temp->m[i]);
     2676      if (j<actdeg) actdeg = j;
     2677    }
     2678  }
     2679  idTest(temp);
     2680  idSkipZeroes(temp);
     2681  idTest(temp);
     2682  syzstr->resPairs = syInitRes(temp,&maxlength,syzstr->Tl,syzstr->cw);
     2683  omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
     2684  omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
     2685  syzstr->res = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
     2686  syzstr->orderedRes = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
     2687  syzstr->elemLength = (int**)omAlloc0((maxlength+1)*sizeof(int*));
     2688  syzstr->truecomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
     2689  syzstr->ShiftedComponents = (long**)omAlloc0((maxlength+1)*sizeof(long*));
     2690  syzstr->backcomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
     2691  syzstr->Howmuch = (int**)omAlloc0((maxlength+1)*sizeof(int*));
     2692  syzstr->Firstelem = (int**)omAlloc0((maxlength+1)*sizeof(int*));
     2693  syzstr->sev = (unsigned long **) omAlloc0((maxlength+1)*sizeof(unsigned long *));
     2694  syzstr->bucket = kBucketCreate();
     2695  int len0=idRankFreeModule(temp)+1;
     2696
     2697  startdeg = actdeg;
     2698  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
     2699  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
     2700/*--- computes the resolution ----------------------*/
     2701  while (nextPairs!=NULL)
     2702  {
     2703    if (TEST_OPT_PROT) Print("%d",actdeg);
     2704    if (TEST_OPT_PROT) Print("(m%d)",index);
     2705    if (index==0)
     2706      i = syInitSyzMod(syzstr,index,len0);
     2707    else
     2708      i = syInitSyzMod(syzstr,index);
     2709    currcomponents = syzstr->truecomponents[si_max(index-1,0)];
     2710    currShiftedComponents = syzstr->ShiftedComponents[si_max(index-1,0)];
     2711    rChangeSComps(currcomponents, currShiftedComponents,
     2712                  IDELEMS(syzstr->res[si_max(index-1,0)]));
     2713    j = syInitSyzMod(syzstr,index+1);
     2714    if (index>0)
     2715    {
     2716      syRedNextPairs(nextPairs,syzstr,howmuch,index);
     2717      syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
     2718    }
     2719    else
     2720      syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
     2721/*--- creates new pairs -----------------------------*/
     2722    syCreateNewPairs(syzstr,index,i);
     2723    if (index<(maxlength-1))
     2724    {
     2725      syCreateNewPairs(syzstr,index+1,j);
     2726    }
     2727    index++;
     2728    nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
     2729    //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
     2730  }
     2731  if (temp!=NULL) idDelete(&temp);
     2732  kBucketDestroy(&(syzstr->bucket));
     2733  if (origR != syzstr->syRing)
     2734    rChangeCurrRing(origR);
     2735  pDeleteLm(&redpol);
     2736  if (TEST_OPT_PROT) PrintLn();
     2737  return syzstr;
     2738}
     2739
Note: See TracChangeset for help on using the changeset viewer.