function [dpsi_drho,dpsip_dx] = eval_psip(x,~,~,model,gauss)
% function [dpsi_drho,d_dx(dpsi_drho)] = eval_psip(x,g,v,model,whichgrid)
% #codegen

if ~gauss
    dpsi_drho = model.psi.Lamp * x(model.psi.xind,:);
else
    dpsi_drho = model.psi.Lampgauss * x(model.psi.xind,:);
end

if nargout>1
    dpsip_dx = zeros(numel(dpsi_drho),numel(x));
    if ~gauss
        dpsip_dx(:,model.psi.xind) = model.psi.Lamp;
    else
        dpsip_dx(:,model.psi.xind) = model.psi.Lampgauss;
    end
end

return
