Ask Your Question
0

sparse differential of a chain complex

asked 2013-08-05 18:16:29 +0200

parsons.kyle.89 gravatar image

updated 2013-08-06 11:56:22 +0200

I'm trying to convert a simplicial complex into a chain complex and then extract the differential map. However the simplicial complex is rather large and sage runs out of memory when it tries to make the conversion. However, the differential should be a very sparse matrix and there should be plenty of memory to store a sparse representation of the differential. Is it possible to have sage compute the differential as a sparse matrix? Specifically the method which gives the out of memory error is chain_complex().

edit retag flag offensive close merge delete

Comments

For the method, do you mean `chain_complex` rather than `simplicial_complex`?

John Palmieri gravatar imageJohn Palmieri ( 2013-08-06 11:34:37 +0200 )edit

Yes sorry I've corrected that.

parsons.kyle.89 gravatar imageparsons.kyle.89 ( 2013-08-06 11:56:45 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-08-06 12:50:32 +0200

One option, if you can't get Sage to work, is to use CHomP. You could define your simplicial complex X in Sage and then do

sage: f = open('filename.txt', 'w')
sage: f.write(X._chomp_repr_())
sage: f.close()

This will save X in CHomP format in the file filename.txt. Also, from a shell prompt ("$"), run

$ sage -i -s chomp

This will compile several CHomP programs, including simchain, which you should be able to run using

$ /path/to/sage/spkg/build/chomp-20130518.p1/src/bin/simchain filename.txt output.txt

Then the file output.txt will have the chain complex data for your simplicial complex. It will be stored in CHomP format, but it's readable. You might be able to extract what you need straight from this file, or you can write some code to process the file, say read it into Sage and convert it to Sage matrices, and then work with those.

edit flag offensive delete link more

Comments

Thank you for your help. I am having success with this, but the problem now is that _chomp_repr_ renames all my vertices to integers. However, the names of the vertices are important. Is there a way to also output a table that matches up the new and old names?

parsons.kyle.89 gravatar imageparsons.kyle.89 ( 2013-08-12 23:38:49 +0200 )edit

I've actually found the answer to my own question. Asking for X._numeric_representation gives the desired list.

parsons.kyle.89 gravatar imageparsons.kyle.89 ( 2013-08-13 14:00:14 +0200 )edit
0

answered 2013-08-06 11:51:06 +0200

The chain_complex method already produces sparse matrices:

sage: Y = simplicial_complexes.NotIConnectedGraphs(6,2)
sage: Y.f_vector()
[1, 15, 105, 455, 1365, 3003, 4945, 5715, 3990, 1470, 306, 30]
sage: C = Y.chain_complex()
sage: C.differential(4)
1365 x 3003 sparse matrix over Integer Ring

How big is your simplicial complex? What is its f-vector?

edit flag offensive delete link more

Comments

The f-vector is [1, 4096, 18945, 14850]. I would ideally like to work with complexes much larger than this if possible. The reason I thought that sage would return a dense matrix is the error I got. > File "matrix_integer_dense.pyx", line 226, in sage.matrix.matrix_integer_dense.Matrix_integer_dense.__cinit__ (sage/matrix/matrix_integer_dense.c:6865) MemoryError: out of memory allocating a matrix

parsons.kyle.89 gravatar imageparsons.kyle.89 ( 2013-08-06 12:14:25 +0200 )edit

Can you tell in which dimension it fails? If you do `X.chain_complex(dimensions=range(2))`, for example, does it work? Also, how much RAM does your computer have?

John Palmieri gravatar imageJohn Palmieri ( 2013-08-06 12:41:29 +0200 )edit

Restricting the dimension still fails. It also fails if dimensions = [1,2]. I'm running sage as a virtual machine image on Windows. The virtual machine has 512 MB of RAM (is that a lot or a little?). In actuality my computer has 4 GB.

parsons.kyle.89 gravatar imageparsons.kyle.89 ( 2013-08-06 18:21:20 +0200 )edit

That's not very much RAM, probably the bare minimum to run Sage. If you can double or quadruple it, that might help.

John Palmieri gravatar imageJohn Palmieri ( 2013-08-07 11:39:53 +0200 )edit

(By "that's not very much RAM", I meant 512 MB, not 4 GB.)

John Palmieri gravatar imageJohn Palmieri ( 2013-08-14 15:01:54 +0200 )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

Stats

Asked: 2013-08-05 18:16:29 +0200

Seen: 525 times

Last updated: Aug 06 '13