Extracted dim check to separate function and supported change on the fly of the basis. Created special builder for sparse vectors