In C99 it's possible to do dynamic allocation of multidimensional arrays:
void blah(int n) {
int a[n][n];
...}
but this does not seem to be supported in Cython. If I try
sage -cython on
def t(int n):
cdef int a[n][n]
cdef int i, j
for i in range(n):
for j in range(n):
a[i][j]=i+j
return a[0][n-1]
I get
Error compiling Cython file:
------------------------------------------------------------
...
def t(int n):
cdef int i, j
cdef int a[n][n]
^
------------------------------------------------------------
m.pyx:3:18: Not allowed in a constant expression
As I have C99 code I'd like to hook up to Sage, I'd really
like to know how to get around this limitation (with as little overhead
as possible)
Thanks,
Dima
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.