IP Library Granted Patent US 6,895,574
Granted Patent B2
US 6,895,574 · App. 09/895,902 · Granted May 17, 2005

Method and apparatus for automatically producing efficient code for computing derivatives

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 6,895,574
App. No.
09/895,902
Granted
May 17, 2005
Kind
B2
Abstract

One embodiment of the present invention provides a system that automatically computes a derivative of a numerical expression within a digital computer system. The system operates by receiving a representation of the numerical expression, wherein the numerical expression includes one or more independent variables. Next, the system forms an expression tree for the derivative of the numerical expression with respect to an independent variable, wherein the expression tree makes use of temporary variables to form results of sub-expressions for computing the derivative. While forming this expression tree, the system seeks to introduce only temporary variables and associated sub-expressions as necessary to eliminate repeated common sub-expressions, thereby substantially minimizing the number of temporary variables. The system subsequently uses this expression tree to compute the derivative of the numerical expression during a computation.

Claims (72)

1. A method for automatically generating code to compute a derivative of a numerical expression within a digital computer system, comprising:

receiving a representation of the numerical expression within the digital computer system, wherein the numerical expression includes one or more independent variables;

storing the representation in a computer memory;

forming an expression tree for the derivative of the numerical expression with respect to an independent variable, wherein the expression tree makes use of temporary variables to form results of sub-expressions for computing the derivative of the numerical expression; and

wherein forming the expression tree involves seeking to introduce only temporary variables and associated sub-expressions as necessary to eliminate repeated common sub-expressions, thereby substantially minimizing the number of temporary variables; and

using the expression tree to generate code to compute the derivative of the numerical expression during a computation.

2. The method of claim 1 , wherein for each temporary variable in the expression tree, the method forms an expression for a partial derivative of the temporary variable with respect to each independent variable.

3. The method of claim 2 , wherein forming the expression for a given partial derivative involves defining new temporary variables and corresponding sub-expressions and new partial derivatives.

4. The method of claim 1 , wherein a given sub-expression can include a multinomial that contains more than one binary operation.

5. The method of claim 1 , further comprising pruning sub-expressions and associated temporary variables that are not used by the computation.

6. The method of claim 5 , wherein pruning sub-expressions involves:

marking all temporary variables used in evaluating the expression tree; and

deleting unmarked temporary variables and associated sub-expressions.

7. The method of claim 1 ,

wherein the method is performed within a compiler; and

wherein the representation of the numerical expression is in the form of an Abstract Syntax Tree (AST).

8. The method of claim 1 ,

wherein the method is performed within a pre-compiler;

wherein the expression tree is in the form of a source code list; and

wherein each temporary variable and associated sub-expression in the expression tree is represented by computer code that sets the temporary variable equal to the associated sub-expression.

9. The method of claim 1 , wherein the method is performed by code within a code library.

10. The method of claim 1 ,

wherein the computation involves interval arithmetic; and

wherein the one or more independent variables are interval variables.

11. A computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method for automatically generating code to compute a derivative of a numerical expression within a digital computer system, the method comprising:

receiving a representation of the numerical expression within the digital computer system, wherein the numerical expression includes one or more independent variables;

storing the representation in a computer memory;

forming an expression tree for the derivative of the numerical expression with respect to an independent variable, wherein the expression tree makes use of temporary variables to form results of sub-expressions for computing the derivative of the numerical expression; and

wherein forming the expression tree involves seeking to introduce only temporary variables and associated sub-expressions as necessary to eliminate repeated common sub-expressions, thereby substantially minimizing the number of temporary variables; and

using the expression tree to generate code to compute the derivative of the numerical expression during a computation.

12. The computer-readable storage medium of claim 11 , wherein for each temporary variable in the expression tree, the method forms an expression for a partial derivative of the temporary variable with respect to each independent variable.

13. The computer-readable storage medium of claim 12 , wherein forming the expression for a given partial derivative involves defining new temporary variables and corresponding sub-expressions and new partial derivatives.

14. The computer-readable storage medium of claim 11 , wherein a given sub-expression can include a multinomial that contains more than one binary operation.

15. The computer-readable storage medium of claim 11 , wherein the method further comprises pruning sub-expressions and associated temporary variables that are not used by the computation.

16. The computer-readable storage medium of claim 15 , wherein pruning sub-expressions involves:

marking all temporary variables used in evaluating the expression tree; and

deleting unmarked temporary variables and associated sub-expressions.

17. The computer-readable storage medium of claim 11 ,

wherein the method is performed within a compiler; and

wherein the representation of the numerical expression is in the form of an Abstract Syntax Tree (AST).

18. The computer-readable storage medium of claim 11 ,

wherein the method is performed within a pre-compiler;

wherein the expression tree is in the form of a source code list; and

wherein each temporary variable and associated sub-expression in the expression tree is represented by computer code that sets the temporary variable equal to the associated sub-expression.

19. The computer-readable storage medium of claim 11 , wherein the method is performed by code within a code library.

20. The computer-readable storage medium of claim 11 ,

wherein the computation involves interval arithmetic; and

wherein the one or more independent variables are interval variables.

21. An apparatus for automatically generating code to compute a derivative of a numerical expression within a digital computer system, comprising:

a receiving mechanism that is configured to receive a representation of the numerical expression within the digital computer system, wherein the numerical expression includes one or more independent variables;

a storing mechanism that is configured to store the representation in a computer memory;

an expression tree forming mechanism that is configured to form an expression tree for the derivative of the numerical expression with respect to an independent variable, wherein the expression tree makes use of temporary variables to form results of sub-expressions for computing the derivative of the numerical expression; and

wherein the expression tree forming mechanism seeks to introduce only temporary variables and associated sub-expressions as necessary to eliminate repeated common sub-expressions, thereby substantially minimizing the number of temporary variables; and

an execution mechanism that is configured to use the expression tree to generate code to compute the derivative of the numerical expression during a computation.

22. The apparatus of claim 21 , wherein for each temporary variable in the expression tree, the expression tree forming mechanism is configured to form an expression for a partial derivative of the temporary variable with respect to each independent variable.

23. The apparatus of claim 22 , wherein in forming the expression for a given partial derivative, the expression tree forming mechanism is configured to define new temporary variables and corresponding sub-expressions and new partial derivatives.

24. The apparatus of claim 21 , wherein a given sub-expression can include a multinomial that contains more than one binary operation.

25. The apparatus of claim 21 , further comprising a pruning mechanism that is configured to prune sub-expressions and associated temporary variables that are not used by the computation.

26. The apparatus of claim 25 , wherein the pruning mechanism is configured to:

mark all temporary variables used in evaluating the expression tree; and to

delete unmarked temporary variables and associated sub-expressions.

27. The apparatus of claim 21 ,

wherein the apparatus resides within a compiler; and

wherein the representation of the numerical expression is in the form of an Abstract Syntax Tree (AST).

28. The apparatus of claim 21 ,

wherein the apparatus resides within a pre-compiler;

wherein the expression tree is in the form of a source code list; and

wherein each temporary variable and associated sub-expression in the expression tree is represented by computer code that sets the temporary variable equal to the associated sub-expression.

29. The apparatus of claim 21 , wherein the apparatus includes code within a code library.

30. The apparatus of claim 21 ,

wherein the computation involves interval arithmetic; and

wherein the one or more independent variables are interval variables.

Assignments (1)
MERGER AND CHANGE OF NAME Recorded Dec 12, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037278/0842 →