SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
Vectorize Errors in Nested Arrays in SS 7251
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
|
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
1 user thanked ndtma for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: ndtma 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 (10kb) downloaded 16 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
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 |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: ndtma 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...". |
|
3 users thanked mkraska for this useful post.
|
on 12/01/2020(UTC), on 13/01/2020(UTC), on 13/01/2020(UTC)
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
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. Regarding the famous uninformative "Results is above max. allowed positive number." here is another example whit this error. Regards, Radovan Edited by user 12 January 2020 21:53:21(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
1 user thanked omorr for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: omorr 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? |
|
1 user thanked mkraska for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: ndtma 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 (19kb) downloaded 23 time(s).
|
1 user thanked Jean Giraud for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: mkraska 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
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jean Giraud If you have red or not as demanded, IMHO: the bug is SS 7251. Revisit the last attached Vectorize Nest_Sub.sm
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Originally Posted by: Jean Giraud 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. Also many thanks to Martin and Omorr for your comments. |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: ndtma Thank you Jean. No errors in 7251 Hello Collab from so far away, maybe, that's what you were after ? Cheers ... Jean Vectorize Nest_Sub.sm (24kb) downloaded 17 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Originally Posted by: Jean Giraud 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 |
|
|
|
SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
Vectorize Errors in Nested Arrays in SS 7251
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.