fixes #1187, refactor log det and type bug in array alloc
Merge pull request #1188 from stan-dev/bugfix/issue-1187-log-det-adjoint

fixes #1187, refactor log det and type bug in array alloc