Vectorize Errors in Nested Arrays in SS 7251

Vectorize Errors in Nested Arrays in SS 7251 - Mensajes

#1 Publicado: 12/1/2020 6:09:32
NDTM Amarasekera

NDTM Amarasekera

130 me gusta en 352 mensajes.

Grupo: User

Observed errors with nested arrays as shown in SS 7251.
Vectorize Errors in Nested Arrays.sm (45,57 KiB) descargado 1488 vez(es).

Vectorize Errors in Nested Arrays.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
A 1 usuarios les gustó este mensaje
Radovan Omorjan 12/1/2020 15:11:00
#2 Publicado: 12/1/2020 11:27:23
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

Observed errors with nested arrays as shown in SS 7251.


There is no error, as well SS 6179.
Smath native vectorize is superior to MCD, then more instructions.
Cheers ... Jean

Vectorize Errors in Nested Arrays Doctored.sm (9,83 KiB) descargado 1458 vez(es).

VectorizeNest.PNG

#3 Publicado: 12/1/2020 14:13:45
NDTM Amarasekera

NDTM Amarasekera

130 me gusta en 352 mensajes.

Grupo: User

May be I have not properly understood the vectorize operator.
Thank you Jean.
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#4 Publicado: 12/1/2020 15:35:14
Martin Kraska

Martin Kraska

1.361 me gusta en 2.275 mensajes.

Grupo: Moderator

Wrote

Observed errors with nested arrays as shown in SS 7251.



I think the observed behaviour matches the following hypothesis on how vectorize() operates:
- search for array-valued operators in the expression (before executing any part of the vectorized expression). in your case it is Z.
- Determine length of these operators. In your case length(Z)=4.
- If all non-scalar operators share the same length, then generate a loop for index = 1..length. Otherwise complain about length mismatch. In your case this iterates over the four sub-matrices.
- within the loop, apply the original expression, with the non-scalar expression replaced by the indexed one. In your case extraction of first element and subsequent rounding is applied to each of the four subvectors.
- return a vector with the stacked results of each iteration.

In the second case, the error results from failing to extract element number four from the last two vectors (having less than 4 elements).

The hypothesis doesn't, however, explain the last error "Result is above...".


Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
A 3 usuarios les gustó este mensaje
Radovan Omorjan 12/1/2020 16:24:00, NDTM Amarasekera 13/1/2020 2:25:00, sergio 13/1/2020 8:00:00
#5 Publicado: 12/1/2020 15:36:52
Radovan Omorjan

Radovan Omorjan

325 me gusta y 1 no me gusta en 2.052 mensajes.

Grupo: Moderator

Hello,

For this case short answer will be that we have to use both/all indexes for the nested arrays.
As Martin explained, we have to be careful about how the things are going on with vectorize operator.

nested.png

Regarding the famous uninformative "Results is above max. allowed positive number." here is another example whit this error.

abovemaxi.png

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
A 1 usuarios les gustó este mensaje
sergio 13/1/2020 8:00:00
#6 Publicado: 12/1/2020 15:56:22
Martin Kraska

Martin Kraska

1.361 me gusta en 2.275 mensajes.

Grupo: Moderator

Wrote

Hello,

For this case short answer will be that we have to use both/all indexes for the nested arrays.
As Martin explained, we have to be careful about how the things are going on with vectorize operator.



Radovan, unfortunately your example isn't consistent with my hypothesis
Single and double index el(Z,1) and el(Z,1,1) both return exactly the same result (first submatrix) if applied on the canvas.
So there is no hint why to expect different results when applying vectorize().

Can the developers please shed some light on this?
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
A 1 usuarios les gustó este mensaje
Radovan Omorjan 12/1/2020 16:02:00
#7 Publicado: 12/1/2020 16:33:08
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

May be I have not properly understood the vectorize operator.
Thank you Jean.


Thank you as well NDTMA, very educative example.
You can have more otherwise ... Ah !
Cheers ... Jean

Vectorize Nest_Sub.sm (18,12 KiB) descargado 1513 vez(es).
A 1 usuarios les gustó este mensaje
sergio 13/1/2020 8:00:00
#8 Publicado: 12/1/2020 16:58:32
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

Can the developers please shed some light on this?


If you have red or not as demanded, IMHO: the bug is SS 7251.
Revisit the last attached Vectorize Nest_Sub.sm
#9 Publicado: 12/1/2020 17:59:20
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

If you have red or not as demanded, IMHO: the bug is SS 7251.
Revisit the last attached Vectorize Nest_Sub.sm



VectorizeNestMore.PNG

#10 Publicado: 13/1/2020 1:59:14
NDTM Amarasekera

NDTM Amarasekera

130 me gusta en 352 mensajes.

Grupo: User

Wrote

Originally Posted by: Jean Giraud [url=/forum/yaf_postsm60333_Vectorize-Errors-in-Nested-Arrays-in-SS-7251.aspx#post60333][/url]If you have red or not as demanded, IMHO: the bug is SS 7251.
Revisit the last attached Vectorize Nest_Sub.sm



Thank you Jean. No errors in 7251.
Vectorize_Ex_Jean_7251.png

Also many thanks to Martin and Omorr for your comments.
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#11 Publicado: 13/1/2020 11:18:48
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

Thank you Jean. No errors in 7251


Hello Collab from so far away,
maybe, that's what you were after ?
Cheers ... Jean

roundNest.PNG

Vectorize Nest_Sub.sm (23,18 KiB) descargado 1408 vez(es).
#12 Publicado: 13/1/2020 14:32:29
NDTM Amarasekera

NDTM Amarasekera

130 me gusta en 352 mensajes.

Grupo: User

Wrote

Hello Collab from so far away,
maybe, that's what you were after ?
Cheers ... Jean



Yes. I also did it using a traditional loop method.
But yours is more elegant.
Thanks.
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
  • Nuevos mensajes
  • Sin mensajes nuevos