function [ y ] = forward_substitutions( L, b )
% FORWARD_SUBSTITUTIONS solve the linear system L y = b by means of the
% forward subsitutions algorithm; L must be a lower triangular matrix
%  [ y ] = forward_substitutions( L, b )
%  Inputs: L = lower triangular matrix (square matrix)
%          b = vector (right hand side of the linear system)
%  Output: y = solution vector (column vector)
%

n = size( L, 1 );
y = zeros( n, 1 );

y( 1 ) = b( 1 ) / L( 1, 1 );
for i = 2 : n
    j_v = 1 : i - 1;
    y( i ) = 1 / L( i, i ) * ( b( i ) - L( i, j_v ) * y( j_v ) ); 
end

return