44 # define strrchr rindex
64 for (
int i = 0;
i < size;
i++) data[
i] =
matrix (r, c);
76 name = m.name ? strdup (m.name) : NULL;
82 for (
int i = 0;
i < size;
i++) data[
i] = m.data[
i];
88 if (name) free (name);
89 if (data)
delete[] data;
94 if (name) free (name);
95 name = n ? strdup (n) : NULL;
106 assert (v.
getSize () == size &&
107 r >= 0 && r < rows && c >= 0 && c < cols);
108 for (
int i = 0;
i < size;
i++) data[
i].
set (r, c, v.
get (
i));
115 assert (r >= 0 && r < rows && c >= 0 && c < cols);
117 for (
int i = 0;
i < size;
i++) res.
add (data[
i].
get (r, c));
127 static char str[256];
128 sprintf (str,
"%s[%d,%d]", n, r + 1, c + 1);
136 static char str[256];
137 sprintf (str,
"%c[%d,%d]", n, r + 1, c + 1);
148 if (n == NULL)
return NULL;
149 if ((p =
strchr (n,
'[')) != NULL) {
150 r = atoi (p + 1) - 1;
151 if ((p =
strchr (p,
',')) != NULL) {
152 c = atoi (p + 1) - 1;
153 if ((p =
strchr (p,
']')) != NULL) {
156 if ((len =
strchr (n,
'[') - n) > 0) {
157 p = (
char *) malloc (len + 1);
173 int& rs,
int& cs,
int& ss) {
182 if (strstr (vn, name) == vn) {
208 if (rs >= 0 && cs >= 0 && ss > 0) {
215 if (strstr (vn, name) == vn) {
231 idx >= 0 && idx < size);
238 assert (idx >= 0 && idx < size);
338 for (
int i = 0;
i < size;
i++) data[
i] += a.
get (
i);