Convert flat item list to the nested list representation of a multidimensional Fortran array with shape 's'.
(items, s)
| 311 | return lst |
| 312 | |
| 313 | def _fa(items, s): |
| 314 | """Convert flat item list to the nested list representation of a |
| 315 | multidimensional Fortran array with shape 's'.""" |
| 316 | if atomp(items): |
| 317 | return items |
| 318 | if len(s) == 0: |
| 319 | return items[0] |
| 320 | lst = [0] * s[0] |
| 321 | stride = s[0] |
| 322 | for i in range(s[0]): |
| 323 | lst[i] = _fa(items[i::stride], s[1:]) |
| 324 | return lst |
| 325 | |
| 326 | def carray(items, shape): |
| 327 | if listp(items) and not 0 in shape and prod(shape) != len(items): |