フィルターのクリア

How to perform matrix calculations with operators?

2 ビュー (過去 30 日間)
elham sa
elham sa 2015 年 7 月 17 日
編集済み: elham sa 2015 年 7 月 17 日
I want to solve a least square problem, say with \ or lsqlin. My matrix C is huge, so I want to represent it with an operator. I have defined "mtimes" and "ctranspose" for my operator, so C*x and C'*x are defined, but I don't know how to do "mldivide".
Generally, how do Matlab functions [that accept matrices as input] work with operators? (say eigs, or lsqlin, ...)
Specifically, my question is how should I do something like this:
A = myOperator(parameter1, parameter2);
x = im2double(imread('cameraman.tif'));
y = imnoise(x, 'gaussian' , 0,0.01);
y = y(:);
g = lsqlin(A,y);
As I said, A*x(:) and A'*x(:) are defined.
Any help is appreciated.

採用された回答

Steven Lord
Steven Lord 2015 年 7 月 17 日
You could try calling one of the sparse iterative linear solvers as the "workhorse" behind your object's implementation of MLDIVIDE. Each of them can accept a function handle instead of a matrix as the coefficient matrix representing the system to be solved. See the description of each individual solver to learn what that function handle needs to return to the solver, usually either A*x or A'*x and sometimes both based on a flag.
  1 件のコメント
elham sa
elham sa 2015 年 7 月 17 日
編集済み: elham sa 2015 年 7 月 17 日
Awesome! Thank you Steven for your help! lsqr(A,...) accepts a function as input, so I don't have to redefine MLDIVIDE.
But generally does that mean that if I define A*x, A'*x, ... such that they return what a Matlab function accepts, I can replace the matrix in the input with my function handle? For example MLDIVIDE does a QR factorization to solve the LSQ problem, that would work if A*x, A'*x, ... are well-defined?? How could it possibly do a QR on a function??

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Least Squares についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by