sparse and dense polynomial kernel for JavaScript