Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LRT_infinite_dimensional_systems
conI
Commits
e8db3aa2
Commit
e8db3aa2
authored
Sep 03, 2020
by
Ferdinand Fischer
Browse files
Fixed muliplication of empty quantities
parent
6fbaea5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
+quantity/Discrete.m
View file @
e8db3aa2
...
...
@@ -1656,8 +1656,9 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
sa
=
size
(
a
);
sb
=
size
(
b
);
if
sa
(
2
)
==
0
&&
sb
(
1
)
==
0
error
(
"Error: quantities with dimensions (n, 0) * (0, m) cannot be multiplied"
);
if
sa
(
2
)
==
0
&&
sb
(
1
)
==
0
&&
sb
(
end
)
~=
0
error
(
"quantity:Discrete:mTimes"
,
...
"Error: quantities with dimensions (n, 0) * (0, m) cannot be multiplied"
);
else
P
=
quantity
.
Discrete
.
empty
([
sa
(
1
:
end
-
1
)
sb
(
2
:
end
)]);
end
...
...
+unittests/+quantity/testDiscrete.m
View file @
e8db3aa2
...
...
@@ -1310,6 +1310,13 @@ testCase.verifyTrue( numeric.near( squeeze(double(a * 42)), [sin(z * pi) * 42, c
testCase
.
verifyTrue
(
numeric
.
near
(
squeeze
(
double
(
s
*
a
'
)),
[
sin
(
z
*
pi
)
*
42
,
cos
(
z
*
pi
)
*
42
]));
testCase
.
verifyTrue
(
numeric
.
near
(
squeeze
(
double
(
a
*
s
)),
[
sin
(
z
*
pi
)
*
42
,
cos
(
z
*
pi
)
*
42
]));
%% test multiplication with empty quantities
e1
=
quantity
.
Discrete
.
empty
([
3
,
0
]);
testCase
.
verifyTrue
(
isempty
(
e1
.'
*
e1
)
);
testCase
.
verifyError
(
@
()
e1
*
e1
.'
,
"quantity:Discrete:mTimes"
)
testCase
.
verifyEqual
(
size
(
e1
*
quantity
.
Discrete
.
empty
()),
[
3
0
])
end
function
testOnConstant
(
testCase
)
...
...
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