added piecewise linear predictor variations. changed allocation of w to fit with parameter h