Build Q vector. Partial preprocess.