Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - 日本語

Change language to:
English - Français - Português

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab manual >> Scilab > Scilab keywords > backslash (\)

backslash (\)

左行列除算.

呼び出し手順

x=A\b

説明

バックスラッシュは左行列除算を定義します. x=A\bA*x=bの解です.

A が正方で非特異の場合, x=A\b (唯一の解) は x=inv(A)*b と等価です(しかし,計算コストははるかに小さくなります).

A が正方でない場合, x は最小二乗解となります. すなわち, norm(A*x-b) は最小値 (ユークリッドノルム)となります. A が列フルランクの場合,最小二乗解, x=A\b, は 唯一の解 (norm(A*x-b)を最小化する唯一の xが存在)となります. A が列フルランクでない場合, 最小二乗解は唯一ではなくなり, x=A\bは一般に最小ノルム解ではなくなります (最小ノルム解は x=pinv(A)*bです).

A.\B(i,j) エントリが A(i,j)\B(i,j)となる行列となります. A.\BA*ones(B).\B (または A.\(B*ones(A)) と等価になります.

A\.B は定義されていない演算子です. この演算子は, * または /.のように新しい演算子を定義する際に使用できます(オーバーロード参照).

A=rand(3,2);b=[1;1;1]; x=A\b; y=pinv(A)*b;  x-y
A=rand(2,3);b=[1;1]; x=A\b; y=pinv(A)*b; x-y, A*x-b, A*y-b
A=rand(3,1)*rand(1,2); b=[1;1;1]; x=A\b; y=pinv(A)*b; A*x-b, A*y-b
A=rand(2,1)*rand(1,3); b=[1;1]; x=A\b; y=pinv(A)*b; A*x-b, A*y-b 

// A benchmark of several linear solvers

[A,descr,ref,mtype] = ReadHBSparse(SCI+"/modules/umfpack/examples/bcsstk24.rsa"); 

b = 0*ones(size(A,1),1);

tic();
res = umfpack(A,'\',b);
printf('\ntime needed to solve the system with umfpack: %.3f\n',toc());

tic();
res = linsolve(A,b);
printf('\ntime needed to solve the system with linsolve: %.3f\n',toc());

tic();
res = A\b;
printf('\ntime needed to solve the system with the backslash operator: %.3f\n',toc());
<< ans Scilab keywords brackets >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jan 26 16:25:00 CET 2011