function [C]=eval_bi(x,w_fh,xi)
%-----------------------------------------------------------------
% This function evaluates the F-H's basis functions b_i at the points xi.
%
% INPUTS:
% x - vector of nodes
% w_fh - vector of F-H's weights
% xi - vector of points, where we want to evaluate basis function b_i
%
% OUTPUTS:
% C - matrix of evaluations
%  ---------------------------------------------------------------
% Authors: 
%      Stefano De Marchi and Cinzia Bandiziol
%      Department of Pure and Applied Math.
%      University of Padova
%   
%           
% Version: May 2015		
%  ----------------------------------------------------------------	

n=size(x,1);
a=size(xi,1);

A1=repmat(xi',n,1)-repmat(x,1,a);

% Get distances between nodes and interpolation points
[r, c]=find(A1==0);
component=find(A1==0);

A2=ones(n,a)./A1;
W_fh=repmat(w_fh,1,a);
B=A2.*W_fh;
sum_den_vect=sum(B,1);
sum_den_matrix=repmat(sum_den_vect,n,1);

% Compute the matrix C: on k-th row there is the evaluation of b_k at xi
C=B./sum_den_matrix;
C(:,c)=0;
C(component)=1;
