Mercurial > octave-dspies
comparison libinterp/corefcn/dot.cc @ 18671:78fac67300e8
maint: Periodic merge of gui-release to default.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 24 Apr 2014 08:41:30 -0700 |
parents | 6a71e5030df5 60562e5c8bfb |
children |
comparison
equal
deleted
inserted
replaced
18669:cf3db95a75f0 | 18671:78fac67300e8 |
---|---|
142 // Change to column vectors. | 142 // Change to column vectors. |
143 dimx = dimx.redim (1); | 143 dimx = dimx.redim (1); |
144 argx = argx.reshape (dimx); | 144 argx = argx.reshape (dimx); |
145 dimy = dimy.redim (1); | 145 dimy = dimy.redim (1); |
146 argy = argy.reshape (dimy); | 146 argy = argy.reshape (dimy); |
147 match = ! error_state; | 147 match = ! error_state && (dimx == dimy); |
148 } | 148 } |
149 | 149 |
150 if (match) | 150 if (match) |
151 { | 151 { |
152 int dim; | 152 int dim; |
262 %! y = int8 ([5 6; 7 8]); | 262 %! y = int8 ([5 6; 7 8]); |
263 %! assert (dot (x, y), [26 44]); | 263 %! assert (dot (x, y), [26 44]); |
264 %! assert (dot (x, y, 2), [17; 53]); | 264 %! assert (dot (x, y, 2), [17; 53]); |
265 %! assert (dot (x, y, 3), [5 12; 21 32]); | 265 %! assert (dot (x, y, 3), [5 12; 21 32]); |
266 | 266 |
267 %% Test input validation | |
268 %!error dot () | |
269 %!error dot (1) | |
270 %!error dot (1,2,3,4) | |
271 %!error <X and Y must be numeric> dot ({1,2}, [3,4]) | |
272 %!error <X and Y must be numeric> dot ([1,2], {3,4}) | |
273 %!error <sizes of X and Y must match> dot ([1 2], [1 2 3]) | |
274 %!error <sizes of X and Y must match> dot ([1 2]', [1 2 3]') | |
275 %!error <sizes of X and Y must match> dot (ones (2,2), ones (2,3)) | |
276 %!error <DIM must be a valid dimension> dot ([1 2], [1 2], 0) | |
267 */ | 277 */ |
268 | 278 |
269 DEFUN (blkmm, args, , | 279 DEFUN (blkmm, args, , |
270 "-*- texinfo -*-\n\ | 280 "-*- texinfo -*-\n\ |
271 @deftypefn {Built-in Function} {} blkmm (@var{A}, @var{B})\n\ | 281 @deftypefn {Built-in Function} {} blkmm (@var{A}, @var{B})\n\ |