rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
LUPQ_Handle.m
1 classdef LUPQ_Handle < handle
2  % handle for passing l-u-p-q-factors to functions
3 
4  properties
5  % factors
6  L; U; P; Q;
7  end
8 
9  methods
10 
11  % constructor
12  function this = LUPQ_Handle(varargin)
13  if nargin == 1
14  [this.L, this.U, this.P, this.Q] = lu(varargin{1});
15  elseif nargin == 4
16  this.L = varargin{1};
17  this.U = varargin{2};
18  this.P = varargin{3};
19  this.Q = varargin{4};
20  end
21  end
22 
23  % matrix multiplication
24  function mat = mtimes(this, mat)
25  mat = this.P' * (this.L * (this.U * (this.Q' * mat)));
26  end
27 
28  % matrix left division
29  function mat = mldivide(this, mat)
30  mat = this.Q * (this.U \ (this.L \ (this.P * mat)));
31  end
32 
33  end
34 end