Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Scilab 5.5.0
Change language to: English - Français - Português - Русский

Scilabヘルプ >> Linear Algebra > Linear Equations > linsolve

# linsolve

### 呼び出し手順

`[x0,kerA]=linsolve(A,b [,x0])`

### パラメータ

A

a `na x ma` 実数行列 (疎行列の場合もあり)

b

`na x 1`ベクトル (`A`の行と同じ次元)

x0

kerA

`ma x k` 実数行列

### 説明

`linsolve` は, `A*x+b=0`の解を全て計算します.

`x0` は特解 (存在する場合), `kerA``A`のヌル空間です. 任意の`w`について`x=x0+kerA*w`は, `A*x+b=0`を満たします.

### 例

```A=rand(5,3)*rand(3,8);
b=A*ones(8,1);[x,kerA]=linsolve(A,b);A*x+b   //compatible b
b=ones(5,1);[x,kerA]=linsolve(A,b);A*x+b   //uncompatible b
A=rand(5,5);[x,kerA]=linsolve(A,b), -inv(A)*b  //x is unique

// Benchmark with other linear sparse solver:

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());```

### 参照

• inv — 逆行列
• pinv — 擬似逆行列
• colcomp — 列圧縮,カーネル,ヌル空間
• im_inv — 原像
• umfpack — solve sparse linear system
• backslash — (\) 左行列除算.