[eigen] Maximum size at compile time |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Maximum size at compile time
- From: Joseph Mirabel <joseph.mirabel@xxxxxxx>
- Date: Thu, 17 May 2018 11:57:33 +0200
- Autocrypt: addr=joseph.mirabel@xxxxxxx; keydata= xsFNBFgtiuYBEACcxg4wIs9+2CwLJzChODHxhe1M4dgi+n+5A6y6MppRgvm7QYCSrE8kDk8Z xuQZoKNnytdg+ZD6BLRVlB65XC6spamjhkEVEcOWPLA5VjCon0bAwYPXlxUoV5TTz1c59xfa 5pYwAxFncuOb8FGl1qqyXXvAvY0Fby5lxXrzWo2UzwXcr+22Ex6DoKaWaDWkxC6z6f92J5Pf hIRDBZUa4w7yeZZWAaq7Tr65mkf80+OkHtN420VO8LwM0mrfu5BT42X99RJ4XEQZXIeaSozi 3O23QYgl4YSWWxH1fKQvX+R/q74dvrcMjpqfR7ZzKpijOIlcnJbW7bAjXEgBd0KXYS+OlGp5 wFV4WRyCUThCv6s8W0BnFKUUFp28cOHWZzCuljbA7cc1/YHHGNg0Dc4dkhDX68+88a3cjpwi 5WCh+3HjZ+hnig1UxmVRX+27gwFUYt3xx/ywEW3XOjGndTVrfPUWNAS/Fh8DusUdBvUaT91E YXE7l3hHNikGMU7XUhM59d6UP9VN3SQrtlcZJbIsF3R1St45PiYIwbEy8BAV42oKiQnTMFYV G9gl57/stsQ6Sf67CPMlrT7xJRmVokT4lx23RtskrvoTjvsf0lA7CW1i3Ts/DccAGavyK2lK cH9OE4D5EQrX0D/BK+v0I96Wj4AcU76uLRYVFHxUvmK51yy+EwARAQABzSFKb3NlcGggTWly YWJlbCA8am1pcmFiZWxAbGFhcy5mcj7CwYIEEwECACwCGyMFCQlmAYAHCwkIBwMCAQYVCAIJ CgsEFgIDAQIeAQIXgAUCWDRzIgIZAQAKCRCwR5VHUw1bmwa+D/oC+hiM77v9uzS681hCOmJ8 aNrNCeXX/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GiMZ0x6XI2QFqVNXqalC0F2RJlCWZeInPfMJKKNdM3u9DDsgvlvk3QCk28 OPq+kdcci/undB+kFEf54cOZELRZ9DshxVHN9KVC/SN+KQHqtD4xROrIg/dRgUQmDB7eFjOl p7bqyc/GfzP7ui6+XY4qxcLINCPgR9Nme3Vjj79UA3X4+wDp4e24p1dH39EaQrlQCnJ9AIoc 6p2e4i/l9ZmKg86JD4T5d9vRkkp2Z4y5oOFRSb0zj4Ggr2IMF4Z06VgzAYvxsmEAEQEAAcLB ZQQYAQIADwUCWC2K5gIbDAUJCWYBgAAKCRCwR5VHUw1bm/8QD/0QrGGsJc9EGpfh8bSIA1Zn shmMytLfdn97WmCwCCHuriQOg+UhaANArRALNeszzOjEFKGvIM/jCMSOKmEnrk7IizDLu7g/ BIiVfrUAR+WsKbmt44A64JerpV53AyIyQwdmeKUPylQosUMwJb3WotsCP3xtHxq/6Um3jHa3 jP1j2HCQXbIKUy/0JyB8QZOfWbEC3rSiqcYz1zYcIRifxmh0QZjCr7foVzH3IXd7nm84AJwM 4IrwelMsreRTq0Lj6/brFw+ZJwR/ycNZtleSw9HvTm4kpfvnB0RXVZEU00u2DgcNMkowZ36m MJ9RUqewPQ+Aks4LGhdI/lBZc9d9l2DVBARIg5oFroGI9VGaiCAXvs82qDpEeSBrAZLLNxV9 e+sdrQlItOd/hf2e/z5gMKVp8rm2NWbm0X7bcP8MpXYr+OoeXuNP4yHwExWxTPHtvLgZ5JR5 Xn+XW7dEORJyfstZVVjCIa4VKoep+QphuvFDgRZZSOGvrezudmJftxak2KYWRi+0iTl7F8/y jTBgUlB1uJHRc75Wklzme6N0tShsraBIqi78ImXtjiuJCvLJsuPtZ6zIyvdPG7Zd0kBrCmLt XcOhKlLFL7g3/dX+RcO4P8JUDshbmjs/0Shd/0D+pDjNxrAC4HC/0pDDghpESX8E4hK8DiGb tuiytIlVETHqaQ==
- Openpgp: preference=signencrypt
Hi Eigen developers,
I have used Eigen for a few years now and I am still amazed by this
library. Thanks a lot for it !
In parts of the code where time is critical, I would like to avoid
dynamic allocation. The matrix size is not know at compile time (and
unbounded). However, at run-time, and outside of these critical regions,
it is possible to know the maximum size of most matrices. Thus, it is
possible to dynamically allocate enough memory in non-critical regions
and use only the necessary part of this allocated memory in critical
regions (thus with no reallocation). I know this can be done with class
Map at the cost of a less readable code. I believe this can also be done
with class Matrix itself, without too much effort. I could not find any
record on the topic. I thus have two questions:
- Is my belief (it would not be too hard to add a run-time maximum size
in class Matrix) correct ?
A (naive ?) approach is to add an option like EnableMaxSizeAtRunTime.
When enabled, a member `max_size` would be added to class `Matrix`.
max_size would always be the allocated size. Then reallocation would be
performed:
* when `Matrix::resize` is called and the requested size is larger
than `max_size`
* when `Matrix::reserve` (a new method) is called.
- Is this of interest for Eigen ?
Cheers,
Joseph