Vectorize Errors in Nested Arrays in SS 7251

Vectorize Errors in Nested Arrays in SS 7251 - Messaggi

#1 Pubblicato: 12/01/2020 06:09:32
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: User

Observed errors with nested arrays as shown in SS 7251.
Vectorize Errors in Nested Arrays.sm (45,57 KiB) scaricato 1492 volta(e).

Vectorize Errors in Nested Arrays.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
1 utenti hanno apprezzato questo post
Radovan Omorjan 12/01/2020 15:11:00
#2 Pubblicato: 12/01/2020 11:27:23
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: 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) scaricato 1465 volta(e).

VectorizeNest.PNG

#3 Pubblicato: 12/01/2020 14:13:45
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: 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 Pubblicato: 12/01/2020 15:35:14
Martin Kraska

Martin Kraska

1.361 apprezzamenti in 2.275 post.

Gruppo: 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
3 utenti hanno apprezzato questo post
Radovan Omorjan 12/01/2020 16:24:00, NDTM Amarasekera 13/01/2020 02:25:00, sergio 13/01/2020 08:00:00
#5 Pubblicato: 12/01/2020 15:36:52
Radovan Omorjan

Radovan Omorjan

325 apprezzamenti e 1 disapprezzamenti in 2.052 post.

Gruppo: 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!"
1 utenti hanno apprezzato questo post
sergio 13/01/2020 08:00:00
#6 Pubblicato: 12/01/2020 15:56:22
Martin Kraska

Martin Kraska

1.361 apprezzamenti in 2.275 post.

Gruppo: 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
1 utenti hanno apprezzato questo post
Radovan Omorjan 12/01/2020 16:02:00
#7 Pubblicato: 12/01/2020 16:33:08
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: 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) scaricato 1516 volta(e).
1 utenti hanno apprezzato questo post
sergio 13/01/2020 08:00:00
#8 Pubblicato: 12/01/2020 16:58:32
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: 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 Pubblicato: 12/01/2020 17:59:20
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: 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 Pubblicato: 13/01/2020 01:59:14
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: 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 Pubblicato: 13/01/2020 11:18:48
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: 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) scaricato 1411 volta(e).
#12 Pubblicato: 13/01/2020 14:32:29
NDTM Amarasekera

NDTM Amarasekera

130 apprezzamenti in 352 post.

Gruppo: 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
  • Nuovi post
  • Nessun nuovo post