Added jsDoc for register matrix logic.