Vectorize Errors in Nested Arrays in SS 7251

Vectorize Errors in Nested Arrays in SS 7251 - Сообщения

#1 Опубликовано: 12.01.2020 06:09:32
NDTM Amarasekera

NDTM Amarasekera

130 сообщений из 352 понравились пользователям.

Группа: User

Observed errors with nested arrays as shown in SS 7251.
Vectorize Errors in Nested Arrays.sm (45 КиБ) скачан 45 раз(а).

Vectorize Errors in Nested Arrays.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
1 пользователям понравился этот пост
Radovan Omorjan 12.01.2020 15:11:00
#2 Опубликовано: 12.01.2020 11:27:23
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 КиБ) скачан 35 раз(а).

VectorizeNest.PNG

#3 Опубликовано: 12.01.2020 14:13:45
NDTM Amarasekera

NDTM Amarasekera

130 сообщений из 352 понравились пользователям.

Группа: 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 Опубликовано: 12.01.2020 15:35:14
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: 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...".


Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
3 пользователям понравился этот пост
Radovan Omorjan 12.01.2020 16:24:00, NDTM Amarasekera 13.01.2020 02:25:00, sergio 13.01.2020 08:00:00
#5 Опубликовано: 12.01.2020 15:36:52
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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 пользователям понравился этот пост
sergio 13.01.2020 08:00:00
#6 Опубликовано: 12.01.2020 15:56:22
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: 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?
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
Radovan Omorjan 12.01.2020 16:02:00
#7 Опубликовано: 12.01.2020 16:33:08
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 КиБ) скачан 38 раз(а).
1 пользователям понравился этот пост
sergio 13.01.2020 08:00:00
#8 Опубликовано: 12.01.2020 16:58:32
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 Опубликовано: 12.01.2020 17:59:20
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 Опубликовано: 13.01.2020 01:59:14
NDTM Amarasekera

NDTM Amarasekera

130 сообщений из 352 понравились пользователям.

Группа: 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 Опубликовано: 13.01.2020 11:18:48
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 КиБ) скачан 33 раз(а).
#12 Опубликовано: 13.01.2020 14:32:29
NDTM Amarasekera

NDTM Amarasekera

130 сообщений из 352 понравились пользователям.

Группа: 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
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений