added cotire, more vectoriztion improvements in compute_K