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

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 help >> 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 = zeros(size(A,1),1);

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

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

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

参照

  • slash — (/) 右除算およびフィードバック
  • inv — 逆行列
  • pinv — 擬似逆行列
  • percent — (%) 特殊文字
  • ieee — 浮動小数点例外モードを設定
  • linsolve — 線形方程式ソルバ
  • umfpack — solve sparse linear system
Report an issue
<< 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:
Tue Apr 02 17:37:31 CEST 2013