[WIP] Sparse input support for decision tree and forest

This pull request aims to finish the work in #2984.

TODO list:

- [x] clean rebase (remove unwanted generated file, merge commit, ...)
- [ ] simpler input validation for tree base method (safe_array, check_array?)
- [ ] reduce testing times
- [ ] read the whole code again
- [ ] use the new safe_realloc
- [ ] update what's new