1 ## Copyright (C) 2003 Motorola Inc
2 ## Copyright (C) 2003 David Bateman
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2 of the License, or
7 ## (at your option) any later version.
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program; If not, see <http://www.gnu.org/licenses/>.
18 ## @deftypefn {Function File} {@var{x} =} concat (@var{a}, @var{b})
19 ## @deftypefnx {Function File} {@var{x} =} concat (@var{a}, @var{b}, @var{dim})
20 ## Concatenate two matrices regardless of their type. Due to the implementation
21 ## of the matrix concatenation in Octave being hard-coded for the types it
22 ## knowns, user types can not use the matrix concatenation operator. Thus
23 ## for the @emph{Galois} and @emph{Fixed Point} types, the in-built matrix
24 ## concatenation functions will return a matrix value as their solution.
26 ## This function allows these types to be concatenated. If called with a
27 ## user type that is not known by this function, the in-built concatenate
30 ## If @var{dim} is 1, then the matrices are concatenated, else if @var{dim}
31 ## is 2, they are stacked.
34 function y = concat ( a, b, dim)
36 if (nargin < 2) || (nargin > 3)
37 usage("concat(a, b, [dim])");
43 ## Protect this with try for the case is the Galois package isn't installed
45 if (isgalois(a) || isgalois(b))
51 if ((b.m != m) || (b.prim_poly != p))
52 error("concat: incompatiable galois variables");
66 y = gf([ax, bx], m, p);
68 y = gf([ax; bx], m, p);
75 ## Protect this with try for the case is the fixed package isn't installed
78 if (isfixed(a) || isfixed(b))
86 y = fixed([a.int, b.int], [a.dec, b.dec], [a.x, b.x]);
88 y = fixed([a.int; b.int], [a.dec; b.dec], [a.x; b.x]);
97 fprintf("What are we doing here!!\n");