norm.sci
来自「小波分解源代码」· SCI 代码 · 共 31 行
SCI
31 行
function y=norm(x,choice)
// Copyright Aldo I Maalouf
[lhs,rhs]=argn()
if rhs<2 ,
y=max(svd(x));
elseif rhs>2
error('warning:the number of the input is error!');
else
temp=size(x);
if temp(1)>1 & temp(2)>1
select choice,
case choice==1 then y= max(sum(abs(x))),
case choice==inf then y= max(sum(abs(x'))),
case choice=='fro' then y=sqrt(sum(diag(x'*x))),
else error('incorrect input');
end
end
if temp(1)==1 | temp(2)==1
select choice,
case choice==inf then y=max(abs(x)),
case choice==-inf then y=min(abs(x)),
else y=sum(abs(x).^choice)^(1/choice),
end
end
if temp(1)==0 | temp(2)==0
y=0;
end
end
endfunction
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?