I saw Ian's video on the camera track alignment tools today. I was trying to add a similar tool to Blender recently.
The main difference is the method I used works on more than 3 points, which could be useful for more complex tracks. It's the same as Extract Transform in Houdini, used to align two point clouds.
For translation and rotation, you can use this method. It uses centroid difference to get the translation, then SVD decomposition to find the rotation, which is meant to be optimal in terms of least squares error.
For scale you can try the umeyama method, but I found it doesn't work for negative scales.