Ask Your Question
0

Creating Element Classes

asked 2012-09-28 01:36:08 +0200

SLOtoSF gravatar image

updated 2012-09-28 01:36:48 +0200

Hi! I want to be able to create elements, and want their parents to be elements, so I've been reading this page: http://www.sagemath.org/doc/reference....

The example shows Cython commands it seems (cdef v def).... Why? Couldn't I just do this in Python?

Excerpt from page cited above.

Elements typically define a method _new_c, e.g.,

cdef _new_c(self, defining data): cdef FreeModuleElement_generic_dense x x = PY_NEW(FreeModuleElement_generic_dense) x._parent = self._parent x._entries = v

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-09-28 05:42:47 +0200

Volker Braun gravatar image

Elements can be implemented in plain Python and in Cython. Often, Cython is used for speed but you don't have to.

You should have a look at the worksheet on http://trac.sagemath.org/11490

edit flag offensive delete link more

Comments

Wonderful. I had no idea that there were these educational worksheets about Sage development. Is there a general repository for them? (I've posted this as a different question). Thanks!

SLOtoSF gravatar imageSLOtoSF ( 2012-09-28 06:00:10 +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: 2012-09-28 01:36:08 +0200

Seen: 402 times

Last updated: Sep 28 '12