Convert flat item list to the nested list representation of a multidimensional Fortran array with shape 's'.
(items, s)
| 299 | return lst |
| 300 | |
| 301 | def _fa(items, s): |
| 302 | """Convert flat item list to the nested list representation of a |
| 303 | multidimensional Fortran array with shape 's'.""" |
| 304 | if atomp(items): |
| 305 | return items |
| 306 | if len(s) == 0: |
| 307 | return items[0] |
| 308 | lst = [0] * s[0] |
| 309 | stride = s[0] |
| 310 | for i in range(s[0]): |
| 311 | lst[i] = _fa(items[i::stride], s[1:]) |
| 312 | return lst |
| 313 | |
| 314 | def carray(items, shape): |
| 315 | if listp(items) and not 0 in shape and prod(shape) != len(items): |