Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - Português

Change language to:
English - Français - 日本語 - Русский

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

Ajuda do Scilab >> Scilab > Scilab palavra-chave > backslash

backslash

(\) divisão matricial direita-esquerda: exact or least square solution

Seqüência de Chamamento

X = A \ B

Descrição

(\) denota a divisão matricial direita-esquerda. x=A\b é a solução para A*x=b.

Se A é quadrada e não-singular, x=A\b (unicamente definida) é equivalente a x=inv(A)*b (mas as computações são menos custosas).

Se A não é quadrada, x é uma solução de mínimo quadrado, i.e., norm(A*x-b) é mínima (norma euclidiana). Se A é de posto coluna cheio, a solução de mínimo quadrado, x=A\b , é unicamente definida (há um único x que minimiza norm(A*x-b)). Se Anão é de posto coluna cheio, então a solução de mínimo quadrado não é única e x=A\b , em geral, não é a solução com norma mínima (a solução com norma mínima é x=pinv(A)*b).

A.\B é a matriz com entrada (i,j) igual a A(i,j)\B(i,j). Se A (ou Bé um escalar, A.\B é equivalente a A*ones(B).\B (ou A.\(B*ones(A))

A\.B é um operador sem significado predefinido. Pode ser usado para definir um novo operador (ver overloading) com a mesma precedência que * ou /.

Exemplos

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/demos/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());

Histórico

VersãoDescrição
5.5.0 The threshold level which switches between Gaussian Elimination with row pivoting and linear least squares when computing A\B is decreased from sqrt(eps) to eps.
Report an issue
<< percent Scilab palavra-chave 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:
Mon Jan 03 14:35:18 CET 2022