Post Reply 
PPL: element-wise operations on Vector
04-25-2016, 10:31 AM
Post: #1
PPL: element-wise operations on Vector
In the previous firmware I was able to write
Code:

x := [1, 2, 3, 4, 5];
y := x.^2 * 9.8765;
which set y to a Vector with the square of each individual element in x.
This "dot-operator" Syntax was identical what I use in Matlab or Octave - very compact and convenient.

In the April 2016 release this is now flagged as a syntax error and I have to resort to a loop or other relatively ugly means to perform the same type of calculations (e.g. using the Matrix initialization function).

Is it correct that this feature was removed? Probably not to recover 8MB of RAM ;-)

Martin
Find all posts by this user
Quote this message in a reply
04-25-2016, 10:50 AM (This post was last modified: 04-25-2016 10:55 AM by DrD.)
Post: #2
RE: PPL: element-wise operations on Vector
Which mode [Home] or [CAS]?

As shown it works in [CAS], but you need to add a space after the x (before the ".^" ) in [HOME]"

x := [1, 2, 3, 4, 5];
y := x .^2 * 9.8765; // x [space] .^2 in [HOME]

-Dale-
Find all posts by this user
Quote this message in a reply
04-25-2016, 12:27 PM
Post: #3
RE: PPL: element-wise operations on Vector
(04-25-2016 10:31 AM)Martin Hepperle Wrote:  Is it correct that this feature was removed? Probably not to recover 8MB of RAM ;-)

From what I know, 8MB of RAM have been recovered without removing any feature.

primer
Find all posts by this user
Quote this message in a reply
04-25-2016, 03:41 PM (This post was last modified: 04-25-2016 03:47 PM by Tim Wessman.)
Post: #4
RE: PPL: element-wise operations on Vector
(04-25-2016 10:31 AM)Martin Hepperle Wrote:  Is it correct that this feature was removed? Probably not to recover 8MB of RAM ;-)

I think it is the space as stated. We will investigate if this is now being flagged on purpose (think 123.*2 - that is rather ambiguous). However, we will investigate it to figure out if this was unintentional.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
04-26-2016, 07:35 AM (This post was last modified: 04-26-2016 07:39 AM by Martin Hepperle.)
Post: #5
RE: PPL: element-wise operations on Vector
(04-25-2016 10:50 AM)DrD Wrote:  Which mode [Home] or [CAS]?

As shown it works in [CAS], but you need to add a space after the x (before the ".^" ) in [HOME]"

x := [1, 2, 3, 4, 5];
y := x .^2 * 9.8765; // x [space] .^2 in [HOME]

-Dale-

Thank you for pointing this out, Dale,

I have this problem inside a program. Not directly in HOME or CAS expressions.

I had simply saved and restored my program which worked in the previous release without the space. I do not think that I was in CAS mode when I ran the program before. At least the behavior should be consistent and documented.

I also found that many programs had some gibberish (far east) characters (thanks to Unicode) attached behind the end of the programs after restoring. Of course the programs then failed the "Check".

Obviously the length of the file read back was longer than the original length and the content of some read buffer was appended.
I used drag and drop in the connectivity toolkit to copy these files from the emulator to the hardware.
I had to remove the (one to three) lines manually after restoring the programs.

Martin
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)