[kepler-dev] Fwd: [Ptolemy] Change in array types

Edward A. Lee eal at eecs.berkeley.edu
Fri Sep 22 17:31:40 PDT 2006


I've checked in to Ptolemy II and Kepler changes to the way array types
are handled.  These changes make it much simpler to specify actors that
operate on arrays and their elements.  I found only two actors in Kepler
that did this, ArrayContains and ArrayRemoveElement, both written
by Effrat.

In both cases, I have updated the actor to use the new mechanism.
Since these seem like useful actors, I've also put versions of them
(without Kepler-isms) into the Ptolemy array library.  I have
added Efrat Jaeger as a contributor to Ptolemy II.

There were a couple of other places in Kepler where there
were simpler uses of array typing... I believe I've fixed all the
ones in the tree... If you have some actors not in the tree that use
arrays in non-trivial ways, you will want to read on.

Details of the changes are in the message below.

Edward

>X-ASG-Debug-ID: 1156899744-6cb500400000-YtAf27
>X-Barracuda-URL: http://bc2.eecs.berkeley.edu:8000/cgi-bin/mark.cgi
>X-Barracuda-Connect: 128.32.48.161
>X-Barracuda-Start-Time: 1156899744
>X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0
>Date: Tue, 29 Aug 2006 15:07:41 -0700
>To: ptresearch at chess.eecs.berkeley.edu,
>         Kepler-Dev <kepler-dev at ecoinformatics.org>
>From: "Edward A. Lee" <eal at eecs.berkeley.edu>
>Cc: "Stephen Neuendorffer" <stephen.neuendorffer at xilinx.com>
>X-ASG-Orig-Subj: [Ptolemy] Change in array types
>Subject: [Ptolemy] Change in array types
>Sender: ptolemy-admin at chess.eecs.berkeley.edu
>X-BeenThere: ptolemy at chess.eecs.berkeley.edu
>X-Mailman-Version: 2.0.3
>List-Unsubscribe: <http://chess.eecs.berkeley.edu/ptolemy/listinfo/ptolemy>,
>         <mailto:ptolemy-request at chess.eecs.berkeley.edu?subject=unsubscribe>
>List-Id: The Ptolemy Project mailing list <ptolemy.chess.eecs.berkeley.edu>
>List-Post: <mailto:ptolemy at chess.eecs.berkeley.edu>
>List-Help: <mailto:ptolemy-request at chess.eecs.berkeley.edu?subject=help>
>List-Subscribe: <http://chess.eecs.berkeley.edu/ptolemy/listinfo/ptolemy>,
>         <mailto:ptolemy-request at chess.eecs.berkeley.edu?subject=subscribe>
>X-ASG-Whitelist: HEADER (^Received:.*gateway[02].eecs.berkeley.edu)
>X-Barracuda-Spam-Score: 0.00
>X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of 
>TAG_LEVEL=2.1 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0
>
>
>I have a fix for the problem Steve identified where ArrayType.convert()
>was not in fact delivering an array of the type of the ArrayType on which
>it is called.  Unfortunately, all our actors that use arrays were
>exploiting this bug as follows:
>
>To declare that an input port has an array type, the actor would say:
>
>         input.setTypeEquals(new ArrayType(BaseType.UNKNOWN));
>
>Of course, this should force the type to be exactly {unknown}, but
>the bug was allowing the type to deviate from that.
>
>The fix touches are large number of files and is not backward compatible.
>Every actor that explicitly operates on arrays had to be changed.
>I suspect that there are many Kepler actors that use arrays, and they
>will all need to be updated.  I'm happy to do that, but I'm wondering
>whether there are actors not in the repository.
>
>Part of the fix actually significantly improves things for writing
>actors that operate on arrays.  For example, ArrayToSequence wants
>to declare that the input is an array and that the output has
>type compatible with the array elements.  Currently, the code
>to do that is pretty obtuse:
>
>         input.setTypeEquals(new ArrayType(BaseType.UNKNOWN));
>         ArrayType inputArrayType = (ArrayType) input.getType();
>         InequalityTerm elementTerm = inputArrayType.getElementTypeTerm();
>         output.setTypeAtLeast(elementTerm);
>
>With my changes, it becomes:
>
>         output.setTypeAtLeast(ArrayType.elementType(input));
>
>This forces the input port to have an array type and the
>output port to have a type at least that of the elements
>of input arrays.
>
>Correspondingly, SequenceToArray currently has obtuse type
>constraint declarations.  These become:
>
>         output.setTypeAtLeast(ArrayType.arrayOf(input));
>
>If you just want to set a constraint that something (e.g.,
>a param) be an array, do:
>
>         param.setTypeAtLeast(ArrayType.ARRAY_BOTTOM);
>
>As usual with type constraints, the same declarations need to
>be made in the clone methods.
>
>I guess a key question is whether to wait until after the
>release to check this in... I doubt we can get copernicus
>fully functional again without it...
>
>Edward
>
>
>------------
>Edward A. Lee
>Professor, Chair of EECS
>231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
>phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
>eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal
>
>_______________________________________________
>Ptolemy maillist  -  Ptolemy at chess.eecs.berkeley.edu
>http://chess.eecs.berkeley.edu/ptolemy/listinfo/ptolemy

------------
Edward A. Lee
Professor, Chair of EECS
231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal  



More information about the Kepler-dev mailing list