Ask Your Question

Revision history [back]

Actually, the answer of @volker-braun was quite satisfactory, since it creates a list that you can call:

# data you should add in your question to ease reproduction:
sage: import numpy as np
sage: N = 4
sage: A = 3

sage: L = [np.empty(A) for j in range(N)]
sage: L[0]
array([  6.89920558e-310,   6.89920558e-310,   0.00000000e+000])
sage: L[3]
array([  6.89920558e-310,   6.89920558e-310,   0.00000000e+000])

But you should notice that elements of a list L are numbered from 0 to len(L)-1.

Perhaps are you looking for a dictionary:

sage: L = dict()
sage: for j in srange(1, N+1):
sage:     L[j]=np.empty(A)
sage: L
{1: array([  6.89920558e-310,   5.92371271e-316,   5.43231038e-310]),
 2: array([  6.89920558e-310,   5.91607169e-316,   5.40520702e-316]),
 3: array([  6.89920558e-310,   5.91582347e-316,   5.43231038e-310]),
 4: array([  6.89920558e-310,   5.91594758e-316,   1.09178468e-316])}
sage: L[1]
array([  6.89920558e-310,   5.92371271e-316,   5.43231038e-310])
sage: L[4]
array([  6.89920558e-310,   5.91594758e-316,   1.09178468e-316])