Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline alyles  
#1 Posted : 22 November 2017 21:06:57(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 274
United States

Was thanked: 91 time(s) in 57 post(s)
I ran across this issue in one of my files. I'm not sure if this is a known issue or not.
It appears if I try to use an element of a matrix in a boolean operation, the evaluation fails.
However, if I first assign that matrix element to another variable, then use that variable in the boolean operation this works.


Edit: This is observed in both 0.98.6528 and 0.98.6484

Untitled.png

Edited by user 22 November 2017 21:09:10(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Jean Giraud  
#2 Posted : 23 November 2017 00:40:32(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: alyles Go to Quoted Post
I'm not sure if this is a known issue or not.


There is no issue in there: the vectorize operator is a descending operator.
Example 2, it compares each successive value with a wild variable, the test is
true twice. Example 1, vectorize descends over two vectors of unequal length.
The indexed is not a wild variable to dispose, rather a vector of single element.

Just erroneous instruction.
thanks 1 user thanked Jean Giraud for this useful post.
on 23/11/2017(UTC)
Offline alyles  
#3 Posted : 23 November 2017 01:06:23(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 274
United States

Was thanked: 91 time(s) in 57 post(s)
That is what appears to happen. But if that's true why does the assignment of a 1x1 vector evaluate to a single value as in V.OUT.


It seems inconsistent.

I should note that in the first expression, V.CLAMP]2 is surrounded by parenthesis, not the matrix brackets.

Edited by user 23 November 2017 01:09:37(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline mkraska  
#4 Posted : 23 November 2017 01:58:01(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,980
Germany

Was thanked: 1120 time(s) in 718 post(s)
vectorize checks for non-scalar variables and then loops over the elements of these variables. For this in order to work, all these variables need to have the same length.

The expression isn't further analyzed before this is done. In particular, there isn't any check if some of the subexpressions might evaluate to scalars (e.g. by applying the index function or absolute value or the like).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 23/11/2017(UTC)
Offline Jean Giraud  
#5 Posted : 23 November 2017 03:44:14(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: alyles Go to Quoted Post
That is what appears to happen. But if that's true why does the assignment of a 1x1 vector evaluate to a single value as in V.OUT.


It seems inconsistent.

I should note that in the first expression, V.CLAMP]2 is surrounded by parenthesis, not the matrix brackets.

That particular Bolean responds to universal rules. Most [if not all] Smath borrows
universal codes/functions. When you assign [1x] to var, you convert to "scalar".
At this point, the vectorize operator can descend and apply the Bolean test to each
of the elements in U. A "scalar" is a vanishing iterator, example: plot canvas.

BoleanTest.PNG

Users browsing this topic
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.