lorentz.m

来自「it is a source code from mathworks」· M 代码 · 共 14 行

M
14
字号
function p = lorentz(x,y)
% LORENTZ  Calculates the Lorentz inner product
%          of the two 4 by 1 vectors x and y

% Written by Kai Borre
% April 22, 1995

%  M = diag([1 1 1 -1]);
%  p = x'*M*y;

   p = x(1)*y(1) + x(2)*y(2) + x(3)*y(3) - x(4)*y(4);

%%%%%%%%%% end lorentz.m %%%%%%%%%%%%%%%

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?