vectorize() with IPluginLowLevelEvaluation functions

vectorize() with IPluginLowLevelEvaluation functions - Messages

#1 Posted: 3/29/2016 8:54:04 PM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

scr5.png

(Last line with error is just to demonstrate that without vectorize(), the error is the same as with vectorize(), so seems that vectorize() has no effect)

I suspect that the problem is because the Bessel function is defined in a IPluginLowLevelEvaluation plugin (StatisticalTools by Davide). This interface is afaik the most used among SMath plugin writers, so it would be desirable to extend vectorize() to work correctly with that kind of plugins.

Please excuse me if my reasoning is incorrect, and the real cause is something other.
С уважением, Михаил Каганский
1 users liked this post
Davide Carpi 3/31/2016 2:09:00 PM
#2 Posted: 3/30/2016 12:45:29 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Hello Boris,

If that's not your first name, then tell us to shoot Vodka !
"Bessel" but which Bessel ?
In Smath 5346, there are quite a few built-in "Bessel" from menu f(x).
I understand what you are attempting, give me a day or two.
For what I can see, vectorising is not the best approach.

Jean

Bessel mwbesselj.sm (8 KiB) downloaded 34 time(s).
#3 Posted: 3/30/2016 1:00:02 AM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

OH MY! Not again!

Wrote

Hello Boris,

If that's not your first name, then tell us to shoot Vodka !
"Bessel" but which Bessel ?
In Smath 5346, there are quite a few built-in "Bessel" from menu f(x).



Wrote

I suspect that the problem is because the Bessel function is defined in a IPluginLowLevelEvaluation plugin (StatisticalTools by Davide).



Quote


I understand what you are attempting, give me a day or two.
For what I can see, vectorising is not the best approach.



I only used any first custom function from my function list, just to demonstrate the problem. I could use e.g. CoolProp wrapper, or anything else.
С уважением, Михаил Каганский
#4 Posted: 3/30/2016 1:21:22 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Mike,

Trust me: vectorising is not a substitute to the right ways of doing.
I have only two legs and 10 fingers ... at night my brain dilutes.

Jean
#5 Posted: 3/30/2016 12:31:46 PM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

Hello.

Wrote

I suspect that the problem is because the Bessel function is defined in a IPluginLowLevelEvaluation plugin (StatisticalTools by Davide). This interface is afaik the most used among SMath plugin writers, so it would be desirable to extend vectorize() to work correctly with that kind of plugins.


Everything you said is correct. I've just improved vectorize function to support functions from plug-ins.

vectorize_improved_1.png

Thank you!

Best regards.
1 users liked this post
Davide Carpi 3/31/2016 2:09:00 PM
#6 Posted: 3/30/2016 2:55:42 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote


Everything you said is correct.
I've just improved vectorize function to support functions from plug-ins.



Which Bessel ? There are 34 "Bessel functions"
Your Bessel is typically a vector of 5*5 = 25 elements.
Still something not correct.

Jean

#7 Posted: 4/2/2016 2:22:43 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Hi all, did not want to open a new vectorize() topic so posting my question here. From what I know about vectorize is that in order for it to evaluate you need to satisfy the following:

1. Arguments must be two matrices with matching dimensions
2. Operator must be applicable to scalar variables

If the above is correct, I might have detected an odd behaviour.

And as a side note: Andrey, please do not get discouraged by all the recent controversy surrounding vectorize(). It is a very useful function. My only suggestion would be to make sure that it consistently follows a simple list of logical rules, and to make this list available in the SMath release notes / documentation.

http://smath.info/cloud/sheet/xVqGb4rhZq

vectorize1.sm (9 KiB) downloaded 41 time(s).
vectorize1.png
#8 Posted: 4/2/2016 5:06:38 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

You didn't test completely ... Ah !

Forum Vectorise Correct.gif
#9 Posted: 4/2/2016 6:23:19 PM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Well, then I will add here, too

scr29.png

This minimal example is completely made up for demonstration only. No meaning in it other than to demonstrate a problem.

Here three pieces are relevant: if(), assignment of y, and eval(). Without any of these, it works.
С уважением, Михаил Каганский
  • New Posts New Posts
  • No New Posts No New Posts