Convert flat item list to the nested list representation of a multidimensional C array with shape 's'.
(items, s)
| 297 | return strides |
| 298 | |
| 299 | def _ca(items, s): |
| 300 | """Convert flat item list to the nested list representation of a |
| 301 | multidimensional C array with shape 's'.""" |
| 302 | if atomp(items): |
| 303 | return items |
| 304 | if len(s) == 0: |
| 305 | return items[0] |
| 306 | lst = [0] * s[0] |
| 307 | stride = len(items) // s[0] if s[0] else 0 |
| 308 | for i in range(s[0]): |
| 309 | start = i*stride |
| 310 | lst[i] = _ca(items[start:start+stride], s[1:]) |
| 311 | return lst |
| 312 | |
| 313 | def _fa(items, s): |
| 314 | """Convert flat item list to the nested list representation of a |