Changeset 7b4fc8 in git


Ignore:
Timestamp:
Apr 22, 2015, 7:17:40 PM (8 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
04b3ef1b32a87e188ccba4b8a4308a0e75f9b895
Parents:
d088e2c2f2336235f058b94a17c4d3453de98df5
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2015-04-22 19:17:40+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2015-04-29 18:04:56+02:00
Message:
Edited  by Hanieh Keneshlou<hkeneshlou@yahoo.com> on 22 Apr. 2015
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/gradedModules.lib

    rd088e2 r7b4fc8  
    5353    mappingcone2(M,N)  mapping cone2?
    5454    grlifting3(A,B)    RND! chain lifting? probably wrong one
    55     grlifting4(A,B)    RND! chain lifting? newer from #hani# for mappingcone3
    5655    mappingcone3(A,B)  mapping cone3? (using grlifting4 at the moment)
    5756    grrange(M)         get the row-weightings
     57    grneg(A)           graded object given by -A
     58    matrixpres(intvec a)   matrix presentation of direct sum of Omega^a[i](i)
    5859";
    5960
     
    14581459
    14591460proc KeneshlouMatrixPresentation(intvec a)
    1460 "
    1461 PURPOSE: Direct sum of all omegas_i(i) with powers a[i]
    1462 NOTE: Please document/name this proc properly
    1463 "
     1461"USAGE:  intvec a.
     1462RETURN: matrix
     1463PURPOSE:matrix presentation for direct sum of omega^a[i](i)
     1464EXAMPLE: example KeneshlouMatrixPresentation; shows an example
    14641465{
    14651466  int n = size(a)-1;
     
    16851686
    16861687proc grlifting(M,N)
    1687 "generic random alpha : coker(M) -> coker(N) "
     1688"USAGE:  graded objects M and N
     1689RETURN: map of chain complexes (as a list)
     1690PURPOSE: construct a map of chain complexes between free resolution of
     1691M=Img(M) and N=Img(N).
     1692EXAMPLE: example grlift; shows an example
     1693"
    16881694{  ASSUME(1, grtest(M));
    16891695   ASSUME(1, grtest(N));
     
    17121718  P[1]= grrndmap( rM[1], rN[1] ); // alpha1
    17131719
    1714   grview(P[1]); print(P[1]); 
    1715 
    1716 //   return();
    1717  
    1718  
     1720  if(t==2){return(P[1]);} 
     1721   
    17191722  for(k=2; k<=t; k++)
    17201723  {
    1721     "k: ", k;
    1722     grview(rN[k-1]);
    1723     grview(P[k-1]);
    1724 
    1725 //    grprod( grtranspose(P[k-1]), grtranspose(rN[k-1])  );
    1726 //    grprod( grtranspose(rN[k-1]), grtranspose(P[k-1])  );
    1727 
    1728 //     grprod( P[k-1], rN[k-1] );
    1729    
    1730 //    grview( _ );
    1731    
    1732 //    rM[k];
    1733     grview(rM[k-1]);
    1734 
    1735     P[k] =  grtranspose( grlift( grtranspose( rM[k-1] ),
    1736        grtranspose( grprod( rN[k-1],  P[k-1] ) ) ) ); // alpha0!
    1737    
    1738 //    P[k] = grlift( grprod(P[k-1],rM[k]), rN[k] ); // ??
    1739     grview(P[k]); 
     1724    P[k] = grlift( grprod(P[k-1],rM[k]), rN[k] );
     1725     grview(P[k]); 
    17401726   
    17411727  }
     
    17911777
    17921778proc mappingcone(M,N)
    1793 "??"
     1779"USAGE:M,N graded objects
     1780RETURN: chain complex (as a list)
     1781PURPOSE: construct a free resolution of the cokernel of a random map between
     1782M=Img(M), and N=Img(N).
     1783EXAMPLE: example mappingcone; shows an example
     1784
    17941785{
    17951786  ASSUME(1, grtest(M));
     
    18241815example
    18251816{ "EXAMPLE:"; echo = 2;
     1817//Veronese surface
    18261818
    18271819ring r=32003, (x(0..4)),dp;
    1828 def I=maxideal(1);
    1829 module R=grobj(module(I), intvec(0));
    1830 resolution FR=mres(R,0);
    1831 print(betti(FR,0),"betti");
    1832 module K=grobj(module(FR[1]),intvec(-1),intvec(0,0,0,0,0));
    1833 module S=grsyz(K);
    1834 grview(S);
    1835 module B=grobj(module([1,0,0],[0,1,0],[0,0,1]),intvec(1,1,1),intvec(1,1,1));
    1836 grview(B);
    1837 
    1838 def Z=grlifting(B,S);
    1839 Z;
    1840 
    1841 def G=mappingcone(B,S);
    1842 G;
    1843 
    1844 
    1845 resolution E=grres(G[1],0);
    1846 print(betti(E,0),"betti");
    1847 module W=grtranspose(G[1]);
    1848 resolution U=grres(W,0);
    1849 ideal P=groebner(flatten(U[2])); // flatten???
    1850 resolution L=mres(P,0);
    1851 print(betti(L),"betti");
     1820def A=KeneshlouMatrixPresentation(intvec(0,0,0,0,3));
     1821def M=grgens(A);
     1822grview(M);
     1823
     1824def B=KeneshlouMatrixPresentation(intvec(0,1,0,0,0));
     1825def N=grgens(B);
     1826grview(N);
     1827
     1828def R=grlifting(M,N);
     1829grview(R);
     1830def T=mappingcone(M,N);
     1831grview(T);
     1832
     1833def U=grtranspose(T[1]);
     1834resolution G=mres(U,0);
     1835print(betti(G),"betti");
     1836ideal I=groebner(flatten(G[2]));
     1837resolution GI=mres(I,0);
     1838print(betti(GI),"betti");
    18521839}
    18531840
     
    20282015    int r=size(v);
    20292016    int s=size(w);
    2030     module zero = (0:s);
     2017    matrix zero[r][s];
    20312018
    20322019    module A=grconcat(P[i],rN[i]);
    20332020    module B=grobj(zero,v,w);
    2034     module C=grconcat(-rM[i-1],B);
     2021    ASSUME( 0, grtest( grneg( rM[i-1]) ) );
     2022    module C=grconcat( grneg( rM[i-1] ) ,B); // FIXME: '-' is wrong! need a graded-enabled minus (e.g. grneg?)
    20352023    module D=grconcat(grtranspose(C), grtranspose(A));
    20362024
     
    20392027  return(T);
    20402028}
     2029
     2030
     2031
    20412032example
    20422033{ "EXAMPLE:"; echo = 2;
     
    20652056def G=mappingcone2(SS,BB);G;
    20662057}
    2067 */
    2068 
    2069 
    2070 
    2071 
    2072 /*
    2073              -f1 0        -f2 0
    2074   (p1 g1)     p2 g2        p3 g3
    2075 G0<-----F0+G1<------F1+G2<-------F2+G3<-----
    2076 
    2077 */
    2078 
    2079 proc mappingcone2(A,B)
    2080 "USAGE: (A,B), graded objects A and B (matrices defining maps)
    2081 RETURN: chain complex (as a list)
    2082 PURPOSE: construct the free resolution of cokernel of a random map between
    2083 M=coker(A), and N=coker(B)
    2084 EXAMPLE: example ????????
    2085 "
    2086 
    2087 {
    2088   ASSUME(1, grtest(A));
    2089   ASSUME(1, grtest(B));
    2090 
    2091   list P=grlifting3(A,B);
    2092   list rM=grres(A,0,1);
    2093   list rN=grres(B,0,1);
    2094 
    2095   int i;
    2096   list T;
    2097 
    2098   T[1]=grconcat(P[1],rN[1]);
    2099 
    2100   for(i=2;i<=size(P);i++)
    2101   {
    2102     intvec v=grrange(rM[i-1]);
    2103     intvec w=grdeg(rN[i]);
    2104     int r=size(v);
    2105     int s=size(w);
    2106     matrix zero[r][s];
    2107 
    2108     module A=grconcat(P[i],rN[i]);
    2109     module B=grobj(zero,v,w);
    2110     module C=grconcat(-rM[i-1],B);
    2111     module D=grconcat(grtranspose(C), grtranspose(A));
    2112 
    2113     T[i]=grtranspose(D);
    2114   }
    2115    return(T);
    2116 }
     2058
     2059
    21172060
    21182061
     
    21712114
    21722115}
     2116
     2117
     2118
    21732119example
    21742120{"EXAMPLE:"; echo = 2;
     
    22002146}
    22012147
     2148
     2149proc grneg(A)
     2150"USAGE: A graded object
     2151RETURN: -A as graded object
     2152PURPOSE: graded map defined by -A.
     2153EXAMPLE: example grneg; shows an example
     2154"
     2155{
     2156  ASSUME(0, grtest(A));
     2157return(grobj(-A,grrange(A), grdeg(A) ));
     2158}
     2159
     2160example
     2161{ "EXAMPLE:"; echo = 2;
     2162ring r=0,(x,y,z),dp;
     2163def A=grobj([x2,yz,xyz],intvec(1,1,0));
     2164grview(A);
     2165def F=grneg(A);
     2166grview(A);
     2167}
     2168
     2169
     2170
     2171
    22022172/*
    22032173             -f1 0        -f2 0
    22042174  (p1 g1)     p2 g2        p3 g3
    22052175G0<-----F0+G1<------F1+G2<-------F2+G3<-----
     2176
    22062177*/
    22072178
    2208 proc grneg(M)
    2209 "negative map
    2210 TODO for Hanieh: please document this and find good motivating examples for this proc!!
    2211 "
    2212 {
    2213   return ( grobj(-M, grrange(M), grdeg(M) ) );
    2214 }
    2215 
    2216 // note: not clear which grlifting3 should be used by the following
    2217 // procedure!!?
     2179
    22182180proc mappingcone3(A,B)
    22192181"USAGE: (A,B), graded objects A and B (matrices defining maps)
     
    22622224   return(T);
    22632225}
     2226
     2227
     2228
    22642229example
    22652230{ "EXAMPLE:"; echo = 2;
     
    22732238grview(T);
    22742239
    2275 def F=grlifting4(A,T); grview(F);
     2240def F=grlifting3(A,T); grview(F);
    22762241
    22772242/* BUG in the proc */
     
    22942259grview(S);
    22952260
    2296 def H=grlifting4(R,S); grview(H);
     2261def H=grlifting3(R,S); grview(H);
    22972262
    22982263/* BUG in the proc */
    2299 def G=mappingcone3(R,S); // ????????
     2264def G=mappingcone3(R,S);
    23002265
    23012266
    23022267def I=KeneshlouMatrixPresentation(intvec(2,3,0,6,2));
    23032268def J=KeneshlouMatrixPresentation(intvec(4,0,1,2,1));
    2304 // def N=grlifting4(I,J);
     2269// def N=grlifting3(I,J);
    23052270/* 2nd module does not lie in the first: */ // def NN=mappingcone3(I,J); // ????????
    23062271
     
    23082273
    23092274
    2310 // this is grlifting3 from #hani# (NOTE that this version is different
    2311 // to the grlifting3 that came within this library!!!
    2312 proc grlifting4(A,B)
    2313 "USAGE: (A,B), graded objects A and B (matrices defining maps)
    2314 RETURN: map of chain complexes (as a list)
    2315 PURPOSE: construct a map of chain complexes between free resolution of
    2316              M=coker(A) and N=coker(B).
    2317 EXAMPLE: example grlifting4; shows an example
    2318 "
    2319 {
    2320            ASSUME(1, grtest(A));
    2321            ASSUME(1, grtest(B));
    2322 
    2323 
    2324            list rM=grres(A,0,1);
    2325            list rN=grres(B,0,1);
    2326            int i,j,k;
    2327 
    2328            for(i=1;i<=size(rM);i++)
    2329            {
    2330              if(size(rM[i])==0){break;}
    2331            }
    2332 
    2333            for(j=1;j<=size(rN);j++)
    2334            {
    2335              if(size(rN[j])==0){break;}
    2336            }
    2337            int t=min(i,j);
    2338 
    2339            list P;
    2340 
    2341            P[t]= grrndmap2( rM[t],rN[t] );
    2342 
    2343            if(t==1){return(P)};
    2344 
    2345            for(k=t-1; k>=1; k--)
    2346            {
    2347              def C = grtranspose(rM[k]);
    2348              def T= grprod(rN[k],P[k+1]);
    2349              def tT = grtranspose(T);
    2350 
    2351              P[k]= grtranspose(grlift(C,tT));
    2352 
    2353            }
    2354            return(P);
    2355 }
     2275
     2276
     2277
     2278
     2279proc matrixpres(intvec a)
     2280"USAGE:  intvec a.
     2281RETURN: matrix.
     2282PURPOSE:matrix presentation for direct sum of omega^a[i](i)
     2283EXAMPLE: example matrixpres; shows an example
     2284
     2285  int n = size(a)-1;
     2286  //  ring r = 32003,(x(0..n)),dp;
     2287  ASSUME(0, nvars(basering)==(n+1));
     2288  int i,j;
     2289
     2290  // find first nonzero exponent a_i
     2291  for(i=1;i<=size(a);i++)
     2292    {
     2293      if(a[i]!=0) {break; };
     2294    }
     2295
     2296  // all zeroes?
     2297  if(i>size(a)) {return (grzero()); };
     2298   for(i=2;i<=n;i++)
     2299    {
     2300      if(a[i]!=0) {break; };
     2301    }
     2302
     2303  module N;
     2304
     2305  if(i>n)
     2306    { // no middle part
     2307      if(a[1]>0)
     2308        {
     2309          N=grtwist(a[1],-1);
     2310
     2311          if(a[n+1]>0)
     2312            { N=grsum(N,grtwist(a[n+1],0));}         
     2313        } 
     2314      else
     2315        { N=grtwist(a[n+1],0);}
     2316     
     2317      return (N); // grorder(N));
     2318    }
     2319
     2320else // i <= n: middle part is present, a_i != 0
     2321    { // a = a1  ... |  i:2, a_2 ..... i: n, a_n | .... i: n+1a_(n+1)
     2322      module I = maxideal(1);
     2323      attrib(I,"isHomog", intvec(0));
     2324      list L = mres(I, 0);
     2325      list kos = grorder(L);
     2326      // make sure that graded maps  are represented by blocks corresponding to the betti diagram?
     2327      int j=size(a)-i;
     2328      def S = grpower(grshift(grobj( kos[j+2], attrib(kos[j+2], "isHomog")),j ), a[i]);
     2329
     2330      i++;
     2331
     2332      for(; i <= n; i++)
     2333        {
     2334          if(a[i]==0) { i++; continue; }
     2335          int j=size(a)-i;
     2336          S = grsum( S, grpower(grshift( grobj( kos[j+2], attrib(kos[j+2], "isHomog")), j), a[i])  );
     2337        }
     2338
     2339      // S is the middle (non-zero) part
     2340
     2341      if(a[1] > 0 )
     2342        {
     2343          N=grsum(grtwist(a[1],-1), S);
     2344        }
     2345      else
     2346        { N = S;}
     2347
     2348      if(a[n+1] > 0 )
     2349        { N=grsum(N, grtwist(a[n+1],0)); }
     2350
     2351
     2352      return ((N)); //      return (grorder(N));
     2353    }
     2354}
     2355
    23562356example
    23572357{"EXAMPLE:"; echo = 2;
    23582358
    2359 ring r=32003,x(0..4),dp;
    2360 
    2361 def A=KeneshlouMatrixPresentation(intvec(0,0,0,0,3));
    2362 grview(A);
    2363 
    2364 def T= KeneshlouMatrixPresentation(intvec(0,1,0,0,0));
    2365 grview(T);
    2366 
    2367 def F=grlifting4(A,T);
    2368 grview(F);
    2369 
    2370 def G=mappingcone3(A,T);grview(G);
    2371 /*
    2372 module W=grtranspose(G[1]);
    2373 resolution U=mres(W,0);
    2374 print(betti(U,0),"betti"); // ?
    2375 ideal P=groebner(flatten(U[2]));
    2376 resolution L=mres(P,0);
    2377 print(betti(L),"betti");
    2378 */
    2379 
    2380 
    2381 def R=KeneshlouMatrixPresentation(intvec(0,0,0,2,0));
    2382 def S=KeneshlouMatrixPresentation(intvec(1,2,0,0,0));
    2383 
    2384 def H=grlifting4(R,S); grview(H);
    2385 
    2386 def G=mappingcone3(R,S); // ????????
    2387 
    2388 def I=KeneshlouMatrixPresentation(intvec(2,3,0,6,2));
    2389 def J=KeneshlouMatrixPresentation(intvec(4,0,1,2,1));
    2390 /* 2nd module does not lie in the first: */ //def N=grlifting4(I,J);
    2391 
    2392 }
     2359def R=matrixpres(intvec(1,4,0,0,0));
     2360def S=matrixpres(intvec(0,0,3,0,0));
     2361}
Note: See TracChangeset for help on using the changeset viewer.