function apply_subspace_transformation(obj,T_left,T_right)
% Apply change-of-subspace transformation.  This function is called when the subspace is collapsed to project 
% into the new lower dimensional subspace.;
    % T_left - The covariant subspace projection matrix.;
    % T_right - The contravariant subspace projection matrix.;
    % (Note that for orthogonal subspace T_left = T_right)
    [tt, ss] = size(T_left);
    % project history terms into new subspace;
    obj.last_df = (T_right.') * (obj.last_df);
    obj.last_theta = (T_left) * (obj.last_theta);
    obj.hist_deltadf = obj.reshape_wrapper(T_right.' * obj.reshape_wrapper(obj.hist_deltadf, [ss,-1]), [tt,-1,obj.N]);
    obj.hist_deltatheta = obj.reshape_wrapper(T_left * obj.reshape_wrapper(obj.hist_deltatheta, [ss, -1]), [tt,-1,obj.N]);
    % project stored hessian for each subfunction in to new subspace;
    obj.b = obj.reshape_wrapper(T_right.' * obj.reshape_wrapper(obj.b, [ss,-1]), [tt, 2.*obj.max_history,obj.N]);
    %% RECOMPUTE full_H & theta_proj when the subspace is collapsed to avoid slow accumulation of numerical errors 
    obj.theta_proj = (obj.P.') * (obj.theta); % theta projected into current working subspace;
    obj.full_H = real(obj.reshape_wrapper(obj.b,[ss,-1]) * obj.reshape_wrapper(obj.b,[ss,-1]).');% full approximate hessian;
end
