Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
04469ddc
Commit
04469ddc
authored
Nov 26, 2010
by
Ferhat Mihoubi
Browse files
- Add variable input arguments
- Correct the error condition in A_times_B_kronecker_C
parent
032957b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
matlab/kronecker/A_times_B_kronecker_C.m
View file @
04469ddc
...
...
@@ -35,9 +35,11 @@ function [err, D] = A_times_B_kronecker_C(A,B,C,fake)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Chek number of inputs and outputs.
if
nargin
>
3
||
nargin
<
2
||
nargout
~=
2
if
nargin
>
4
||
nargin
<
3
||
nargout
~=
2
error
(
'A_times_B_kronecker_C takes 3 or 4 input arguments and provides exactly 2 output arguments.'
)
end
% Get & check dimensions. Initialization of the output matrix.
[
mA
,
nA
]
=
size
(
A
);
[
mB
,
nB
]
=
size
(
B
);
...
...
matlab/kronecker/sparse_hessian_times_B_kronecker_C.m
View file @
04469ddc
function
[
err
,
D
]
=
sparse_hessian_times_B_kronecker_C
(
A
,
B
,
C
,
fake
)
%function [err, D] = sparse_hessian_times_B_kronecker_C(A,B,C)
function
[
err
,
D
]
=
sparse_hessian_times_B_kronecker_C
(
varargin
)
%function [err, D] = sparse_hessian_times_B_kronecker_C(A,B,C
, fake
)
% Computes A * kron(B,C) where A is a sparse matrix.
%
% INPUTS
...
...
@@ -33,16 +33,19 @@ function [err, D] = sparse_hessian_times_B_kronecker_C(A,B,C,fake)
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
A
=
varargin
{
1
};
B
=
varargin
{
2
};
C
=
varargin
{
3
};
fake
=
varargin
{
nargin
};
if
nargout
~=
2
error
(
'sparse_hessian_times_B_kronecker_C provides exactly 2 output arguments.'
)
end
switch
nargin
case
4
D
=
A_times_B_kronecker_C
(
A
,
B
,
C
,
fake
);
[
fake
,
D
]
=
A_times_B_kronecker_C
(
A
,
B
,
C
,
fake
);
case
3
D
=
A_times_B_kronecker_C
(
A
,
B
,
B
,
fake
);
[
fake
,
D
]
=
A_times_B_kronecker_C
(
A
,
B
,
C
);
otherwise
error
(
'Two or Three input arguments required!'
)
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment