4 Full_storage::operator=(Full_storage
const &fs
)
9 for (int i
=0; i
<h
; i
++)
10 for (int j
=0; j
<w
; j
++)
11 els
[i
][j
]= fs
.els
[i
][j
];
15 Full_storage::OK() const
19 assert(maxh
>= h
&& maxw
>= w
);
20 assert(h
>= 0 && w
>= 0);
22 if (maxh
>0) { // access outer elts.
23 Real
*r
= els
[maxh
-1];
27 Real s
= r
[maxw
-1]; // accessing unitialised memory.
35 Full_storage::resize_cols(int newh
)
42 Real
** newa
=new Real
*[newh
];
47 newa
[j
] = new Real
[maxw
];
55 Full_storage::resize_rows(int neww
)
61 for (int i
=0; i
< maxh
; i
++) {
62 Real
* newa
=new Real
[neww
];
63 for (int k
=0; k
< w
; k
++)
72 Full_storage::~Full_storage() {
73 for (int i
=0; i
< maxh
; i
++)
79 Full_storage::resize(int rows
, int cols
)
89 Full_storage::mult_ok(int i
, int j
) const
95 Full_storage::trans_ok(int i
, int j
) const
102 Full_storage::trans_next(int &i
, int &j
) const
104 assert(trans_ok(i
,j
));
113 Full_storage::mult_next(int &i
, int &j
) const
115 assert(mult_ok(i
,j
));
124 Full_storage::delete_column(int k
)
126 assert(0 <= k
&&k
<w
);
127 for (int i
=0; i
< h
; i
++)
128 for (int j
=k
+1; j
<w
; j
++)
129 els
[i
][j
-1]=els
[i
][j
];
133 Full_storage::delete_row(int k
)
135 assert(0 <= k
&&k
<h
);
136 for (int i
=k
+1; i
< h
; i
++)
137 for (int j
=0; j
< w
; j
++)
138 els
[i
-1][j
]=els
[i
][j
];
144 Full_storage::insert_row(int k
)
146 assert(0 <= k
&& k
<=h
);
148 for (int i
=h
-1; i
> k
; i
--)
149 for (int j
=0; j
<w
; j
++)
150 els
[i
][j
]=els
[i
-1][j
];
156 Full_storage::row(int n
) const
159 for (int j
= 0; j
< w
; j
++)
165 Full_storage::column(int n
) const
169 for (int i
= 0; i
<h
; i
++)
175 Full_storage::Full_storage(Full_storage
&s
)
181 Full_storage::clone()
183 return new Full_storage(*this);
188 virtual_smat::get_full(int n
, int m
)
190 return new Full_storage(n
,m
);