Ask Your Question

compiling problems with new versions

asked 2014-11-25 03:19:58 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi, I've been developing a project on my university's computers (which unfortunately run a 4.7.1 version) and on the site, and everything went fine. But as soon as I tried to run the project on cloud.sagemath I ran into problems (like a "keyerror 0" message). After some work I think that these problems are somehow due to the .ngens() function, so I'd like to know if there are some known issues regarding versions update and/or with this particular function. thanks

edit retag flag offensive close merge delete


I think we need some more details, this is pretty vague. We try pretty hard to maintain backwards compatibility but there may be something here. Is there a minimal case you can provide, and edit your question to incorporate?

kcrisman gravatar imagekcrisman ( 2014-11-25 07:40:05 -0600 )edit

I tried to cut of the project a minimal case, but after some more debugging it seems that the problem is that the .homology() function of an acyclic chain complex is an empty dictionary, while according to the documentation it should be a dictionary containing the value 0 in the appropriate degrees. In other terms, i would like the output of: sage: D = ChainComplex({0: identity_matrix(ZZ, 4), 4: identity_matrix(ZZ, 30)}) sage: D.homology()

to be {0: 0, 1: 0, 4: 0, 5: 0}, while on cloud.sagemath it gives back just {}

springfieldgion gravatar imagespringfieldgion ( 2014-11-25 09:23:16 -0600 )edit

I can confirm this is a bug in SMC. I have no problems with old or new Sage outside of the cloud, but it happens there.

kcrisman gravatar imagekcrisman ( 2014-11-25 09:41:16 -0600 )edit

Maybe this is caused by SMC having an optional package installed, which might change the semantics. When I try with a clean build of Sage (without the optional packages installed) then it works as you expect. So possibly this doesn't have anything to do specifically with SMC, but with some optional package. Here's a worksheet, btw:

William Stein gravatar imageWilliam Stein ( 2014-11-25 09:45:06 -0600 )edit

Thanks for the quick clarification! is there any possible known quick way to bypass the problem (I guess I could try to fix my problem somehow, but I would not like to create more mess if it is not necessary)

springfieldgion gravatar imagespringfieldgion ( 2014-11-25 09:55:24 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-11-26 09:55:51 -0600

You could replace your call to D.homology() by D.homology(algorithm='no_chomp'). If that doesn't help, then you'll have to provide more details about what you're doing.

edit flag offensive delete link more


This does not seem to work either, and the same problem arises: the output on the sagenb site (and on the older version) is different from the one on the SMC (and on a 6.3 version on a VM). Which sort of details could be useful? The program basically just computes the homology of a complex and then does operations (such as computing Lefschetz polynomials) on the outputted homology groups.

springfieldgion gravatar imagespringfieldgion ( 2014-11-26 11:09:42 -0600 )edit

So you're doing something like H = D.homology() and then later trying to use H[3] (for example)? What's wrong with my earlier suggestion:

from sage.homology.homology_group import HomologyGroup
    group = H[i]
except KeyError: # i is missing from H, so group is zero
    group = HomologyGroup(0, ZZ)
print group
John Palmieri gravatar imageJohn Palmieri ( 2014-11-26 12:15:20 -0600 )edit

You can replace all the try/except stuff above by:

H.get(i, 0)

as illustrated here.

William Stein gravatar imageWilliam Stein ( 2014-11-30 13:31:15 -0600 )edit

Yes, of course, that's what I should have suggested instead.

John Palmieri gravatar imageJohn Palmieri ( 2014-12-01 11:54:44 -0600 )edit

Thanks! This was really helpful!!

springfieldgion gravatar imagespringfieldgion ( 2014-12-12 04:07:06 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-11-25 03:19:58 -0600

Seen: 78 times

Last updated: Nov 26 '14