600 likes | 761 Views
15’th GAMM-IMACS International Symposium on Scientific Computing, Computer Arithmetic and Verified Numerical Computations Novosibirsk, September 2 3 – 29, 201 2. SCAN ’2012. Sergei I. Zhilin Altai State University Barnaul, Russia sergei@asu.ru.
E N D
15’th GAMM-IMACS International Symposium on Scientific Computing, Computer Arithmetic and Verified Numerical Computations Novosibirsk, September 23–29, 2012 SCAN’2012 Sergei I. Zhilin Altai State University Barnaul, Russia sergei@asu.ru JInterval Library: Principles, Development, and Perspectives Dmitry Ju. Nadezhin Oracle Labs Zelenograd, Russia dmitry.nadezhin@gmail.com
Outline • Why Interval Computations in Java Virtual Machine (JVM)? • JInterval Evolution • Architecture • Functionality and Examples • Applications • Perspectives SCAN 2012
JInterval Library: Principles, Development, and Perspectives Why Interval Computations in JvM? SCAN 2012
Java Is Popular • TIOBE Programming Community Index for September 2012 • Calculated by counting hits of the most popular search engines SCAN 2012
Java Is Popular • RedMonk’s language ranking for September 2012 Popularity Rank on StackOverflow.com (by # of tags) Popularity Rank on Github.com (by # of projects) SCAN 2012
Java Is Popular • Bookscan's reports on the top 3,000 titles sold SCAN 2012
Gap between Interval and Applied Software • Java is an attractive and widely adopted technology for applied software development • Cross-platform portability of applications • General purpose object-oriented language • Almost any language can generate Java bytecodes • Advanced tools for distributed systemsdevelopment • Huge amount of applied libraries • Interval analysis and interval computations have proved to be useful in numerous real-world applications • Interval software in Java is of fragmentary character • Creation of systematic full-featured high-level interval library for Java brings interval tools closer to developers of applied software SCAN 2012
Interval Computations in Java • Is Java suitable for scientific computing? Pro: • Portability of JavaVirtualMachine (JVM) • Safe memory management(no memory leaks and pointer errors) • Network-aware environment • Parallel and distributed computing (threads, RMI) • Strict modelof security • Standard API for GUI,graphics, DBMS, … • Widely adopted • Embedded systems, browsers, … • Development, teaching, … Con: • Low performance • Virtual machine • Interpretation is slow • Overhead cost of safe memory management • Language restrictions • No primitive structure type • No operator overloading • No traditional multidimesional arrays • No full compliance with IEEE 754* • Relatively small number of scientific libraries on Java • Scientific computing traditions: Fortran, С/С++ *Kahan W., Darcy J.D. How Java’s Floating-Point Hurts Everyone Everywhere//ACM 1998 Workshop on Java for High–Performance Network Computing,Stanford University, March 1998, http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf SCAN 2012
Interval Java Libraries • IA_math, 1997 • Classic IA, classic interval elementary functions • Timothy J. Hickey, • Brandeis University, Boston, USA • interval.sourceforge.net/interval/ • Java-XSC, 1999 • Classic IA, rectangular complex IA, classic interval elementary functions, classic and complex interval vectors and matrices • Benjamin R.C. Bedregal, Jose E.M. Dutra • Universidade Federal do Rio Grande do Norte, Natal, Brazil • www.dimap.ufrn.br/~java-xsc/jxsc2007.html SCAN 2012
JInterval Library: Principles, Development, and Perspectives JINTERVAL EVOLUTION SCAN 2012
Stages of JInterval Evolution • Sep 2008 JInterval is started as undergraduate student project ”Childhood” at Altai State University (Barnaul, Russia)http://code.google.com/p/javaintervalmathasu/ • Aug 2009 Dmitry Nadezhin (Sun Labs, Zelenograd, Russia) “Boyhood” joins the projecthttp://kenai.com/projects/jinterval • Jan 2012 Developing reference implementation and “Youth” test suite for P1788 becomes Priority #1 http://java.net/projects/jinterval orhttp://jinterval.java.net SCAN 2012
JInterval (Boyhood): A Priori Requirements The library • Must be clear and easy to use • Should provide flexibility in the choice of interval algebra for computations • Should provide flexibility to extend its functionality • Should provide flexibility in choosing precision of interval boundaries and associated rounding policies • Must be portable • Should provide high performance • Must be open source Priority SCAN 2012
JInterval (Boyhood): Architecture • “Fast” branch: • Interval bounds: double, nearest rounding • IA: set-based, Kaucher, complex rectangular, complex circular, complex ring, complex polar • Interval elementary functions, vectors, matrices • ILS: Gauss, Gauss-Seidel, subdifferential Newton, NonNeg, Shaidurov • “Rational bounds” branch: • Interval bounds: smart rational/double, arbitrary precision, rounding policies, contexts • IA: set-based • Interval elementary functions, vectors, matrices • Generic interfaces on top of branches SCAN 2012
JInterval (Boyhood): Type Hierarchy Interval ClassicRealInterval ComplexInterval RealInterval DoubleInterval ComplexIntervalCircle RationalInterval ComplexIntervalRectangle ComplexIntervalPolar ComplexIntervalRing SCAN 2012
JInterval (Boyhood): Lessons Learned Java r = x.add(y.multiply(z)); Scala r = x + y*z SCAN 2012
JInterval Library: Principles, Development, and Perspectives Architecture SCAN 2012
Class Diagram (package net.java.jinterval.interval) SCAN 2012
Key-role Interfaces • Types graph follows the flavor structure of P1788 • Java interfaces: • Interval Common methods for all flavors • SetInterval Extends Interval with methods for flavor ‘Set Interval’ • KaucherInterval Extends Interval with methods for flavor ‘Kaucher interval’ • ClassicInterval Extends all flavors, because can be mapped to related flavor intervals SCAN 2012
Interface Interval: common methods of all flavors • Intervaldefines common methods of all interval flavors • Defines numerical and boolean operations only SCAN 2012
IntervalContext: interval operations interface • Generic interface IntervalContextdefines signature for interval-valued methods SCAN 2012
KaucherIntervalContext: interval flavor interface • KaucherIntervalContextextends IntervalContextand binds type variable Ito Kaucher interval flavor SCAN 2012
Implementation of interval contexts • There may be several implementations for flavor contexts • SetIntervalContextInfSupBaseandSetIntervalContextInfSup are two tightest implementations of set interval operations and functions (P1788 Level 2, InfSup_F). SCAN 2012
Factory classes for interval contexts • Factory classes create particular instances of interval contexts • SetIntervalContexts • KaucherIntervalContexts SCAN 2012
Exact context • Static method getExact() creates the exact context • All operations in the exact context return intervals with rational bounds – P1788 Level 1 results or throw IrrationalException SCAN 2012
InfSup_F contexts • Static method getInfSup(BinaryValueSetnumberFormat)creates theInfsSup_F contexts with binary floating-point interval representations (BINARY32, BINARY64, BINARY128, …, BINARY1024) SCAN 2012
Core Module Dependencies Graph JInterval packages External dependencies jintervalAggregator of JInterval jinterval-rational-java Rational numbers boehm-crealsBoehm’s constructive reals jinterval-interval-java Intervals, IAs, interval elem. functions fortress-roundingRounding class from Fortress commons-math3Apache Commons Math 3.0 jinterval-ilsInterval linear equation system solver lpsolveJava port of lp_solve jinterval-irInterval regression solver jnaJava access to native libraries mpfr-adapterJNA adapter for native GNU MPFR large-test-javaJInterval tests commons-compressApache Commons Compress 1.4 SCAN 2012
JInterval Library: Principles, Development, and Perspectives Functionality and examples SCAN 2012
Functionality of JInterval (Youth) • Rational arithmetic • flexible inner representation (rational, binary32, binary64, binary128,…) • exact and approximate operations • Extended Rational arithmetic • Rational + {-∞ , +∞} • Interval Arithmetic • Set-based • Kaucher • Elementary Functions • According to P1788 • Dense Vectors and Matrices • Rational, extended rational • Interval • Solvers • ILS Solvers • Hansen-Bliek-Rohn-Ning-Kearfott enclosure +Gauss-Seidel • SubdifferentialNewton • Interval linear regression solver • Data consistency check • Outlier detection • Object status detection • Interval prediction SCAN 2012
Example 1.1. Contexts and Simple Expressions , , , . x+y = [3.0,5.0] x/y = [0.333251953125,1.0] SCAN 2012
Example 1.2. Contexts and Simple Expressions , , , . x+y = [3.0,5.0] x/y = [0.3333333134651184,1.0] SCAN 2012
Example 1.3. Contexts and Simple Expressions , , , . x+y = [3.0,5.0] x/y = [+0x15555555555555555555555555555p-114,+0x1p0] ([0.3333333333333333,1.0]) SCAN 2012
Example 1.4. Contexts and Simple Expressions , , , . x+y = [3.0,5.0] x/y = [+0x1/0x3*2^0,+0x1p0]([0.3333333333333333,1.0]) SCAN 2012
Example 2.1. Decorations sqrt([0.0,1.0]) = [0.0,1.0] COM sqrt([-1.0,1.0]) = [0.0,1.0] CON sqrt([-2.0,-1.0]) = [EMPTY] NDF sqrt([EMPTY]) = [EMPTY] SAF SCAN 2012
Example 2.2. Decorations 1/[0.0,0.0] = [EMPTY] NDF 1/[0.0,1.0] = [1.0,Infinity] CON 1/[4.9E-324,1.0] = [1.0,Infinity] SAF x = [0.0,Infinity] SAF y = 1/x = [0.0,Infinity] CON SCAN 2012
Example 3. (Rump) Compute for , and SCAN 2012
Example 3. (Rump) using ExtendedRational SCAN 2012
Example 3. (Rump) using ExtendedRational === BINARY16 === r=NaN === BINARY32 === r=1.172603964805603 +0x9617e3p-23 === BINARY64 === r=-1.1805916207174113E21 -0x1p70 === BINARY128 === r=1.1726039400531787 +0x12c2fc595b06beb74a518f018c093p-112 === BINARY256 === r=-0.8273960599468214 -0x69e81d3527ca0a45ad7387f39fb6bbbee6d0899f57af4ec62443141c771p-235 === Exact === r=-0.8273960599468214 -0xd5ef/0x1029*2^-4 SCAN 2012
Example 3. (Rump) using SetInterval SCAN 2012
Example 3. (Rump) using SetInterval === BINARY16 === i = [-Infinity,Infinity] === BINARY32 === i = [-6.972078301255262E30,6.972078905718172E30] === BINARY64 === i = [-8.264141345021879E21,5.902958103587058E21] === BINARY128 === i = [-0xffb4f40e9a93e50522d6b9c3f9dp-98,+0x12c2fc595b06beb74a518f018c093p-112] ([-1022.8273960599469,1.1726039400531787]) === BINARY256 === i = [-0x69e81d3527ca0a45ad7387f39fb6bbbee6d0899f57af4ec62443141c771p-235, -0xd3d03a6a4f94148b5ae70fe73f6d777dcda1133eaf5e9d8c48862838ee1p-236] ([-0.8273960599468214,-0.8273960599468213]) === Exact === i = [-0xd5ef/0x1029*2^-4,-0xd5ef/0x1029*2^-4] ([-0.8273960599468214,-0.8273960599468213]) SCAN 2012
Example 4. HBRNK enclosure SCAN 2012
Example 5. Gauss-Seidel Solver A: / | [2.0,4.0] [-2.0,0.0] | | [-1.0,0.0] [2.0,4.0] | \ b: / | [1.0,2.0] | | [-2.0,2.0] | \ x: / | [-1.0,4.0] | | [-1.5,3.0] | \ SCAN 2012
JInterval Library: Principles, Development, and Perspectives Applications SCAN 2012
P1788 Test framework TestSet3.dat IntervalLibraries Adapters TestSet2.dat testBoost Boost TestSet1.dat testCXSC CXSC Launcher testFilib Filib Report testMPFI MPFI testPROFIL PROFIL test<NONAME> <NONAME> SCAN 2012
P1788 Test framework IntervalLibraries Adapters TestSet3.dat testBoost Boost TestSet2.dat testCXSC CXSC Report Launcher testFilib Filib testMPFI MPFI TestSet1.dat testPROFIL PROFIL test<NONAME> <NONAME> SCAN 2012
P1788 Test framework IntervalLibraries Adapters testBoost Boost TestSet3.dat testCXSC CXSC Report Launcher testFilib Filib testMPFI MPFI TestSet2.dat testPROFIL PROFIL test<NONAME> <NONAME> TestSet1.dat SCAN 2012
P1788 Test framework. Sample Run testDemo.dat * div[1,2] [0,1][1,2] [0,0]* sqrt[-Infinity,0][-Infinity,Infinity]* pown[0,0] 0 Report == Filib 3.0.2 div [1.0,2.0] [0.0,1.0] = [1.0,Infinity] : [1.0,Infinity] Ok div [1.0,2.0] [0.0,0.0] = [EMPTY] : [1.7976931348623157E308,Infinity] NOT TIGHT! sqrt [-Infinity,0.0] = [0.0,0.0] : [0.0,0.0] Ok sqrt [-Infinity,Infinity] = [0.0,Infinity] : [-4.9E-324,Infinity] NOT TIGHT! pown [0.0,0.0] 0 = [1.0,1.0] : [1.0,1.0] Ok == == Boost 1.48.0 div [1.0,2.0] [0.0,1.0] = [1.0,Infinity] : [1.0,Infinity] Ok div [1.0,2.0] [0.0,0.0] = [EMPTY] : [EMPTY] Ok sqrt [-Infinity,0.0] = [0.0,0.0] : [0.0,0.0] Ok sqrt [-Infinity,Infinity] = [0.0,Infinity] : [0.0,Infinity] Ok pown [0.0,0.0] 0 = [1.0,1.0] : [EMPTY] CONTAINMENT FAILURE!!! == == MPFI 1.5.1 div [1.0,2.0] [0.0,1.0] = [1.0,Infinity] : [1.0,Infinity] Ok div [1.0,2.0] [0.0,0.0] = [EMPTY] : [-Infinity,Infinity] NOT TIGHT! sqrt [-Infinity,0.0] = [0.0,0.0] : [EMPTY] CONTAINMENT FAILURE!!! sqrt [-Infinity,Infinity] = [0.0,Infinity] : [EMPTY] CONTAINMENT FAILURE!!! Library has no Operation "pown" in line 7 : * pown == SCAN 2012
KNIME • KNIME— open source data mining platform SCAN 2012
KNIME Interval Tools • KNIME— open source data mining platform SCAN 2012
KNIME Nodes for Interval Regression Interval Regression( Learner) Interval Regression(Predictor) Calculates interval predictionY* forX* using modelY = F(X, A) Builds linear interval regression model Y = f(X, A) IR Outlier Detector IR Consistency Detects outliers (observations with underestimated error bound) Checks consistency of input data and sets flow control variable for IF switch SCAN 2012