working min scalar prod