Revert "Revert "removed unused template metaprogram var_to_vi and unused function stack_size()""
Revert "Revert "removed unused template metaprogram var_to_vi and unused function stack_size()""

This reverts commit 1ec3cda3f916e84c33654a00c005331e906b96ee.

stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/stan,stan-dev/math,stan-dev/math,stan-dev/stan,stan-dev/stan,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/stan,stan-dev/stan