EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: What is Matjito?
From: "Jeff Hill" <[email protected]>
To: <[email protected]>
Date: Fri, 3 Mar 2006 15:09:51 -0700
   What is Matjito?

 Pluggable library for fast computation of mathematical expressions
in C++ program. Matjito's input could be either expression string with 
information about mapping of symbols to variables and functions - parser
mode, 
or n-ary tree representing expression (see math_jit.hpp for details of 
representation) - evaluator mode.
 Most intersting part about it is x86 JIT, allowing expressions to be
computed
in really fast way (comparable or even better that code generated by 
optimizing C compilers). It still can be used on non-x86 CPUs, but in not
so fast, interpreting mode, until someone will develop port for another
CPU (I'm considering Sparc port, as it's only non x86 arch I have). 

   Supported platforms.

 Currently it works on x86 Linux and Win32 (both MSVC and MinGW), 
although interpreter's port
to other arches is trivial. JIT's port requires significant efforts,
although.

   Distribution.

 Majito released as GPL software for non-commercial use in GPL products. 
Commercial use is allowed, but requires additional licensing from me.

   Known operations.

 Matjito uses natural syntax for mathematical expressions, such as 
x+x*y**3+sin(t) (and it knows precedence rules). 
Up to date list of fuctions known to Matjito can be found in math_jit.hpp 
(note that depending on current 
evaluator some functions may be not implemented, so you should always 
use lookup_internal() to figure out if function in here - see 
jit_test_dyn.cpp as an example).
 The only kinda tricky part is that ** is treated as integer power, 
while ^ as exp(ln()) power.


   Current limitations.

1. Only a few functions implemneted in JITter (at the moment of writing:
basic math (add, sub, mul, div. rem), sin, cos, sqrt, abs). Everything else 
should be provided by user in form of external functions.
2. FPU exception handling currently not implemented (probably not a big
deal)
  
  
    Examples.

 You can examine supplied examples of Matjito usage in newton.cpp, 
gold_sec.cpp, jit_test_dyn.cpp. 
 Those are 2 simple numerical methods - finding root using modified Newton's

method and finding minimum using golden section, and one example of more 
advanced Matjito use.


-----Original Message-----
From: Jeff Hill [mailto:[email protected]] 
Sent: Friday, March 03, 2006 2:47 PM
To: 'Andrew Johnson'
Cc: [email protected]; [email protected]
Subject: RE: calcPerform expressions: 'NOT' operator



> Summary: I am working on changes and enhancements to the calcPerform 
> code

The ability to use real variable names in the expressions instead of A, B, C
etc might also be needed for client specified CA subscription update
filters. 

A quick look in the free software directory revealed Matjito which appears
to have that capability and many others including an X86 JIT compiler. 

Disclaimer: I havent looked at this close enough yet to hazard an opinion on
whether we would want to use it or not, and whether a JIT compiler would
noticably improve performance in this context isnt clear either. 

http://sourceforge.net/projects/matjito/

The Author did indicate earlier that he might sign a grant of license. 

Jeff

> -----Original Message-----
> From: Andrew Johnson [mailto:[email protected]]
> Sent: Friday, March 03, 2006 1:56 PM
> To: Tech Talk
> Subject: calcPerform expressions: 'NOT' operator
> 
> 
> Summary: I am working on changes and enhancements to the calcPerform
> code in R3.14, and am considering making a change that will alter the 
> behaviour of expressions that use the 'NOT' operator in 
> future versions 
> of EPICS.  Please respond if this change will adversely affect your 
> site, i.e. if you actually make heavy use of the 'NOT' operator (as 
> against the related '-', '~' or '!' operators).
> 
> The libCom calc subsystem is used by the calc and calcout records,
> Channel Access security module, MEDM and probably some other client 
> tools to evalutate expressions.  It provides separate operators for 
> doing logical and bitwise operations, for example '&' is a 
> bitwise AND 
> while '&&' is a logical AND.  The operator 'AND' is also 
> supported as a 
> synonym for the bitwise operator, and has parallel operators 
> 'OR' and 'XOR'.
> 
> When it comes to the unary NOT operations however, the operator 'NOT'
> does not match the bitwise '~' not operator, but instead performs a 
> NEGATE operation like the unary minus operator.  This obscure 
> behavior 
> is documented in the Record Reference manual.
> 
> The current 'NOT' operator dates back to a time when the expression
> parser only supported the use of '-' as a binary subtraction 
> operator, 
> and for some reason the keyword 'NOT' was picked for the unary minus 
> operator.  However the ability to use '-' for unary minus was 
> added by 
> Janet in R3.12.0beta7 about 11 years ago, so I'm now 
> proposing to change 
> 'NOT' to be a synonym for the bitwise operator '~'.
> 
> Please reply if you object to this change because your site
> uses 'NOT' 
> in a significant number of CALC expressions of a 3.14 
> database or Access 
> Security configuration file.
> 
> 
> To reward anyone who was interested enough to read to the
> bottom of this 
> message, here's what I'm up to:  I've been significantly 
> improving the 
> error checking and reporting from the expression parser, and 
> have added 
> an assignment operator ':=' and expression terminator ';'.  A single 
> CALC record can now return multiple results, although it is still 
> subject to the 40 character limit for the expression string.
> 
> - Andrew
> --
> There is no S in exprexxo.
> 



Navigate by Date:
Prev: RE: calcPerform expressions: 'NOT' operator Jeff Hill
Next: Re: calcPerform expressions: 'NOT' operator Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: calcPerform expressions: 'NOT' operator Chestnut, Ronald P.
Next: EDM now supports MAC OS-X Ernest L. Williams Jr.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·