unvectorized cost