


compute projection to reduced space with given constraint matrix THIS FUNCTION IS NO USER FUNCTION.


0001 function projectToReduced = computeProjectionFromConstraint(... 0002 constraintMatrix, zerotol) 0003 % compute projection to reduced space with given constraint matrix 0004 % 0005 % THIS FUNCTION IS NO USER FUNCTION. 0006 0007 % The elk-library: convex geometry applied to crystallization modeling. 0008 % Copyright (C) 2012 Alexander Reinhold 0009 % 0010 % This program is free software: you can redistribute it and/or modify it 0011 % under the terms of the GNU General Public License as published by the 0012 % Free Software Foundation, either version 3 of the License, or (at your 0013 % option) any later version. 0014 % 0015 % This program is distributed in the hope that it will be useful, but 0016 % WITHOUT ANY WARRANTY; without even the implied warranty of 0017 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0018 % General Public License for more details. 0019 % 0020 % You should have received a copy of the GNU General Public License along 0021 % with this program. If not, see <http://www.gnu.org/licenses/>. 0022 0023 [~, S, V] = svd(constraintMatrix); 0024 if size(S, 1) == 1 0025 reducedDimension = double(S(1) == 0); 0026 else 0027 S(isZero(S(:), zerotol)) = 0; 0028 reducedDimension = sum(diag(S) == 0); 0029 end 0030 projectToReduced = V(:, (end-reducedDimension+1):end); 0031 0032 end