You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
445 B

3 years ago
%--------------------------
% @Author: Jingqiao Hu
% @Date: 2020-12-16 15:40:22
% @LastEditTime: 2020-12-16 15:40:30
% I = eye(2,2);
% PP = u*(F + F'-2*I) + l * trace(F-I) * I;
%--------------------------
function P = PK1_fast_linear(u, l, F)
m = size(F,2);
FT = F([1,3,2,4], :); % 4*m
trF = F(1,:) + F(4,:) - 2; % 1*m
I = repmat([1;0;0;1], 1, m); % 4*m
P = u(:)' .* (F + FT - 2*I) + l(:)' .* trF .* I;
end