Advantage of vectorize function - Data Analysis Using Truth Tables - Messages
to find the Standardized Precipitation Index (SPI).
58 years of daily precipitation data was available.
The SPI is widely used to analyze meteorological drought on a range of
time scales. There are proprietary software packages for this purpose.
The “vectorize” function was pretty handy and fast in analyzing various conditions.
SPI_cal-Rev & Improved-Final.sm (1 MiB) downloaded 162 time(s).
Rainfal_Data.xlsx (486 KiB) downloaded 117 time(s).
necessary to extract numerical values removing any strings, or
negative values, zeros etc.
Data Analysis Using Truth Table.sm (78 KiB) downloaded 92 time(s).
WroteAttached file may be useful in handling data, where it may be
necessary to extract numerical values removing any strings, or
negative values, zeros etc.
Maybe more or otherwise in there.
Utilities Matrix Truth Table.sm (59 KiB) downloaded 99 time(s).
Utilities Matrix Truth Table [UNSORTED alyles].sm (15 KiB) downloaded 90 time(s).
Utilities Matrix Truth Table [Locate row_col].sm (43 KiB) downloaded 95 time(s).
Another practical example attached, with extensive use of the vectorize function. No loops used.
Comments by Martin, Jean, Razonar and others on this subject much appreciated.
Hope this may be useful for beginners.
Cheers
SPI_cal-Millawana_Multiple_R5.sm (178 KiB) downloaded 91 time(s).
rainfall_KalaOyaBAsin.xlsx (585 KiB) downloaded 66 time(s).
WroteComments by Martin, Jean, Razonar and others on this subject much appreciated.
Sorry mon Ami ... SS 6179 does not open ... Jean
The data file consists of date strings, and hence, had to be transformed into numeric.
Hope this may be useful for beginners. Vectorize function very useful in this exercise.
Handling DATE STRINGS.sm (16 KiB) downloaded 73 time(s).
Take care my Friend ... Jean
WroteAttached is a simplified version of a project work for demonstration only.
The data file consists of date strings, and hence, had to be transformed into numeric.
Hope this may be useful for beginners. Vectorize function very useful in this exercise.
Hi. Handling data strings you have also this cheat for convert dates to numeric matrices.
Handling DATE STRINGS.sm (20 KiB) downloaded 72 time(s).
Best regards.
Alvaro.
Thank you Razonar for the superb alternative. Take care.
WroteAttached is a simplified version of a project work for demonstration only.
The data file consists of date strings, and hence, had to be transformed into numeric.
Hope this may be useful for beginners. Vectorize function very useful in this exercise.
Revised program to handle date strings.
Handling DATE STRINGS+Alvaro.sm (43 KiB) downloaded 61 time(s).
WroteRevised program to handle date strings.
Thanks Collab for that most useful work.
Saved ... for future use.
Cheers ... Jean
WroteAttached is a simplified version of a project work for demonstration only.
Hi Amarasekera. Yes, that one, thanks. The fact you're showing despite to me about the speed in procedures with arrays. In the attached some comments about the need to redefining M:=M where M is a matrix argument in a procedure.
EvalTest.sm (17 KiB) downloaded 67 time(s).
EvalTest.pdf (73 KiB) downloaded 53 time(s).
Best regards.
Alvaro.
As it looks, pure numerical code coincidence as a fact.
Slightly adapted for convenience SS 6179
Thanks, cheers ... Jean
Maths eval(,) TEST.sm (16 KiB) downloaded 65 time(s).
WroteHi Amarasekera. Yes, that one, thanks. The fact you're showing despite to me about the speed in procedures with arrays. In the attached some comments about the need to redefining M:=M where M is a matrix argument in a procedure.
Best regards.
Alvaro.
Alvaro,
Are you showing that by redefining Mo variable, within the program, it speeds it up 30 fold? That makes no sense

The only thing that remotely comes to mind is that M, being defined within the program structure as M:=Mo, is not having to read for the variable from the outside.
Have you, or anyone else, tried this on other programs?
Wrote
Alvaro,
Are you showing that by redefining Mo variable, within the program, it speeds it up 30 fold? That makes no sense![]()
Yes. Please, try to check in your environment if this is true also. (Notice that my laptop is very slow, because always is running something else or overloaded by some other procedures)
Wrote
Have you, or anyone else, tried this on other programs?
Yes. For this was the issue in the original Amarasekera work, and why I say that he was the first showing this behavior. But I have other codes where using M:=M speed up slow procedures. Actually anything with a loop over a matrix.
Here intermediate timing result, which I can't explain
Best regards.
-
New Posts
-
No New Posts