On device linear algebra

Convert the linear algebra ops on dats to dtrt and do it on the device.