In a previous thread I, most thankfully, learned that if B := A for some Array A, then B will not be a reinstantiation of A, which is most simply ascertained with the command eval(A = B) which here evaluates true.
On several occassions, though, I would like reinstantiation. This, I found out, can be done in at least two ways; B := Array(A), or B := map(eval,A). However, in such simple reinstantiations information about for instance any indexing functions of A is lost. But they can be propagated using the ArrayIndFns(...), as seen from
A := Array(symmetric,1..4,1..4): B := Array(ArrayIndFns(A),A): ArrayIndFns(A),ArrayIndFns(B),evalb(A = B);
On one occasion, though, I misspelled the ArrayIndFns as ArrayIndFcs, that is
A := Array(symmetric,1..4,1..4): B := Array(ArrayIndFcs(A),A): ArrayIndFns(A),ArrayIndFns(B),evalb(A = B);
and Maple responded with losing kernel connection. Can that be considered a bug?
A little correction
eval(A = B) in the first paragraph should of course read evalb(A = B).
Maple 10 and Maple 11 Classic Interface
I tried your statements below with Maple 10 and 11 Classic interface. I never lost connection to the kernel. I also removed the restart commands to see if that made a difference. It did not. I just got an error message, as expected.
>restart:
>A := Array(symmetric,1..4,1..4):
>B := Array(ArrayIndFns(A),A):
>ArrayIndFns(A),ArrayIndFns(B),evalb(A = B);
symmetric, symmetric, false
>restart:
>A := Array(symmetric,1..4,1..4):
>B := Array(ArrayIndFcs(A),A):
>ArrayIndFns(A),ArrayIndFns(B),evalb(A = B);
Error, argument `Array(symmetric,1..4, 1..4, [[...],[...],[...],[...]], datatype = anything, storage = triangular[upper])` is incorrect or out of order
Error, invalid input: ArrayIndFns expects its 1st argument, A, to be of type Array, but received B
Regards,
Georgios Kokovidis
Classic Interface
Thanks for testing. I've just done the same test, using Maple 11 Classic Interface, and I get the same result as you do, i.e., no lost kernel connection.
Do you dare to test it using the non-classic interface?
Classic Interface
I lose the kernel connection with the non classic interface, with ver. 10 and 11.
Regards,
Georgios Kokovidis
Dräger Medical
To boldly go...
Thanks!
copy
The copy() command should produce a copy of an Array along with the indexing function.
Eg, simply,
B := copy(A);
That should work for Array, Matrix, or Vector. It should also reproduce 'storage' and 'order'. The only thing that it does not reproduce, I believe, is the attribute readonly (which makes sense, to me, as I can't see why one would ever want two identical readonly objects).
acer
Super!
Very nice - I was not aware of that.