annotate liboctave/chMatrix.h @ 4720:e759d01692db ss-2-1-53

[project @ 2004-01-23 04:13:37 by jwe]
author jwe
date Fri, 23 Jan 2004 04:13:37 +0000
parents 5719210fff4c
children bd043a433918
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
1 /*
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
2
2847
8b262e771614 [project @ 1997-03-27 16:18:26 by jwe]
jwe
parents: 2828
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
4
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
6
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
10 later version.
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
11
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
15 for more details.
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
16
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
20
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
21 */
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
22
1687
c5f9b6cea4a8 [project @ 1996-01-01 03:22:46 by jwe]
jwe
parents: 1573
diff changeset
23 #if !defined (octave_chMatrix_int_h)
c5f9b6cea4a8 [project @ 1996-01-01 03:22:46 by jwe]
jwe
parents: 1573
diff changeset
24 #define octave_chMatrix_int_h 1
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
25
4192
5719210fff4c [project @ 2002-11-20 16:56:47 by jwe]
jwe
parents: 4066
diff changeset
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
27 #pragma interface
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
28 #endif
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
29
1728
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1687
diff changeset
30 #include <string>
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1687
diff changeset
31
1989
a4b0826e240c [project @ 1996-03-02 00:33:22 by jwe]
jwe
parents: 1882
diff changeset
32 #include "MArray2.h"
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
33
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
34 #include "mx-defs.h"
2349
b369227ce3d2 [project @ 1996-07-27 07:59:20 by jwe]
jwe
parents: 2255
diff changeset
35 #include "str-vec.h"
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
36
1728
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1687
diff changeset
37 class
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1687
diff changeset
38 charMatrix : public MArray2<char>
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
39 {
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
40 friend class ComplexMatrix;
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
41
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
42 public:
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
43
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
44 charMatrix (void) : MArray2<char> () { }
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
45 charMatrix (int r, int c) : MArray2<char> (r, c) { }
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
46 charMatrix (int r, int c, char val) : MArray2<char> (r, c, val) { }
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
47 charMatrix (const MArray2<char>& a) : MArray2<char> (a) { }
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
48 charMatrix (const charMatrix& a) : MArray2<char> (a) { }
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3136
diff changeset
49 charMatrix (char c);
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
50 charMatrix (const char *s);
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3225
diff changeset
51 charMatrix (const std::string& s);
2349
b369227ce3d2 [project @ 1996-07-27 07:59:20 by jwe]
jwe
parents: 2255
diff changeset
52 charMatrix (const string_vector& s);
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
53
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
54 charMatrix& operator = (const charMatrix& a)
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
55 {
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
56 MArray2<char>::operator = (a);
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
57 return *this;
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
58 }
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
59
2384
d9147efd1a93 [project @ 1996-10-12 17:56:38 by jwe]
jwe
parents: 2349
diff changeset
60 bool operator == (const charMatrix& a) const;
d9147efd1a93 [project @ 1996-10-12 17:56:38 by jwe]
jwe
parents: 2349
diff changeset
61 bool operator != (const charMatrix& a) const;
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
62
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
63 // destructive insert/delete/reorder operations
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
64
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
65 charMatrix& insert (const char *s, int r, int c);
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
66 charMatrix& insert (const charMatrix& a, int r, int c);
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
67
3836
b8c1cb5b9fd9 [project @ 2001-05-31 19:30:49 by jwe]
jwe
parents: 3504
diff changeset
68 std::string row_as_string (int, bool strip_ws = false, bool raw = false) const;
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
69
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3136
diff changeset
70 // resize is the destructive equivalent for this one
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3136
diff changeset
71
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3136
diff changeset
72 charMatrix extract (int r1, int c1, int r2, int c2) const;
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3136
diff changeset
73
4017
0eb247b9cc9b [project @ 2002-08-03 04:07:14 by jwe]
jwe
parents: 4015
diff changeset
74 boolMatrix all (int dim = -1) const;
0eb247b9cc9b [project @ 2002-08-03 04:07:14 by jwe]
jwe
parents: 4015
diff changeset
75 boolMatrix any (int dim = -1) const;
3136
af7ec9d3a5e6 [project @ 1998-02-01 20:11:06 by jwe]
jwe
parents: 2847
diff changeset
76
2255
fb9611cfc9d2 [project @ 1996-05-22 19:31:32 by jwe]
jwe
parents: 1993
diff changeset
77 #if 0
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
78 // i/o
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
79
3504
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3225
diff changeset
80 friend std::ostream& operator << (std::ostream& os, const Matrix& a);
5eef8a2294bd [project @ 2000-02-01 10:06:51 by jwe]
jwe
parents: 3225
diff changeset
81 friend std::istream& operator >> (std::istream& is, Matrix& a);
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
82 #endif
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
83
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3836
diff changeset
84 static char resize_fill_value (void) { return '\0'; }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3836
diff changeset
85
1573
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
86 private:
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
87
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
88 charMatrix (char *ch, int r, int c) : MArray2<char> (ch, r, c) { }
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
89 };
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
90
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
91 #endif
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
92
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
93 /*
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
94 ;;; Local Variables: ***
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
95 ;;; mode: C++ ***
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
96 ;;; End: ***
403c60daa8c7 [project @ 1995-10-19 04:34:20 by jwe]
jwe
parents:
diff changeset
97 */