Precomputation: Difference between revisions
No edit summary Tags: Reverted Mobile edit Mobile web edit |
Denisarona (talk | contribs) Undid revision 1024325124 by 176.216.90.176 (talk) |
||
Line 5: | Line 5: | ||
In [[database]]s, the term '''materialization''' is used to refer to storing the results of a precomputation,<ref name="HanKamber2011">{{cite book|author1=Jiawei Han|author2=Micheline Kamber|title=Data Mining: Concepts and Techniques: Concepts and Techniques|url=https://books.google.com/books?id=pQws07tdpjoC&pg=PA159|date=9 June 2011|publisher=Elsevier|isbn=978-0-12-381480-7|page=159}}</ref><ref name="Groppe2011">{{cite book|author=Sven Groppe|title=Data Management and Query Processing in Semantic Web Databases|url=https://books.google.com/books?id=HdVZ2MhzP_4C&pg=PA178|date=29 April 2011|publisher=Springer Science & Business Media|isbn=978-3-642-19357-6|page=178}}</ref> such as in a [[materialized view]].<ref name="MortonOsborne2013">{{cite book|author1=Karen Morton|author2=Kerry Osborne|author3=Robyn Sands |author4=Riyaj Shamsudeen |author5=Jared Still|title=Pro Oracle SQL|url=https://books.google.com/books?id=XUPXAQAAQBAJ&pg=PA48|date=28 October 2013|publisher=Apress|isbn=978-1-4302-6220-6|page=48}}</ref><ref name="AufaureZimányi2012">{{cite book|author1=Marie-Aude Aufaure|author2=Esteban Zimányi|title=Business Intelligence: First European Summer School, EBISS 2011, Paris, France, July 3-8, 2011, Tutorial Lectures|url=https://books.google.com/books?id=UWtes499ZaUC&pg=PA43|date=16 January 2012|publisher=Springer Science & Business Media|isbn=978-3-642-27357-5|page=43}}</ref>0963139378 |
In [[database]]s, the term '''materialization''' is used to refer to storing the results of a precomputation,<ref name="HanKamber2011">{{cite book|author1=Jiawei Han|author2=Micheline Kamber|title=Data Mining: Concepts and Techniques: Concepts and Techniques|url=https://books.google.com/books?id=pQws07tdpjoC&pg=PA159|date=9 June 2011|publisher=Elsevier|isbn=978-0-12-381480-7|page=159}}</ref><ref name="Groppe2011">{{cite book|author=Sven Groppe|title=Data Management and Query Processing in Semantic Web Databases|url=https://books.google.com/books?id=HdVZ2MhzP_4C&pg=PA178|date=29 April 2011|publisher=Springer Science & Business Media|isbn=978-3-642-19357-6|page=178}}</ref> such as in a [[materialized view]].<ref name="MortonOsborne2013">{{cite book|author1=Karen Morton|author2=Kerry Osborne|author3=Robyn Sands |author4=Riyaj Shamsudeen |author5=Jared Still|title=Pro Oracle SQL|url=https://books.google.com/books?id=XUPXAQAAQBAJ&pg=PA48|date=28 October 2013|publisher=Apress|isbn=978-1-4302-6220-6|page=48}}</ref><ref name="AufaureZimányi2012">{{cite book|author1=Marie-Aude Aufaure|author2=Esteban Zimányi|title=Business Intelligence: First European Summer School, EBISS 2011, Paris, France, July 3-8, 2011, Tutorial Lectures|url=https://books.google.com/books?id=UWtes499ZaUC&pg=PA43|date=16 January 2012|publisher=Springer Science & Business Media|isbn=978-3-642-27357-5|page=43}}</ref>0963139378 |
||
37ebr09 |
|||
== Overview == |
== Overview == |
Revision as of 12:58, 21 May 2021
In algorithms, precomputation is the act of performing an initial (program lifecycle phase)|run time]] to generate a lookup table that can be used by an algorithm to avoid repeated computation each time it is executed. Precomputation is often used in algorithms that depend on the results of expensive computations that don't depend on the input of the algorithm. A trivial example of precomputation is the use of hardcoded mathematical constants, such as π and e, rather than computing their approximations to the necessary precision at run time.
In databases, the term materialization is used to refer to storing the results of a precomputation,[1][2] such as in a materialized view.[3][4]0963139378
Overview
Precomputing a set of intermediate results at the beginning of an algorithm's execution can often increase algorithmic efficiency substantially. This becomes advantageous when one or more inputs is constrained to a small enough range that the results can be stored in a reasonably sized block of memory. Because memory access is essentially constant in time complexity (except for caching delays), any algorithm with a component which has worse than constant efficiency over a small input range can be improved by precomputing values. In some cases efficient approximation algorithms can be obtained by computing a discrete subset of values and interpolating for intermediate input values, since interpolation is also a linear operation.
History
Before the advent of computers, printed lookup tables of values were used by people to speed up hand calculations of complex functions, such as in trigonometric tables, logarithm tables, and tables of statistical density functions[5] School children are often taught to memorize "times tables" to avoid calculations of the most commonly used numbers (up to 9 x 9 or 12 x 12). Even as early as 493 A.D., Victorius of Aquitaine wrote a 98-column multiplication table which gave (in Roman numerals) the product of every number from 2 to 50 times and the rows were "a list of numbers starting with one thousand, descending by hundreds to one hundred, then descending by tens to ten, then by ones to one, and then the fractions down to 1/144" [6]
Examples
Even modern computer implementations of digital trigonometric functions often use precomputed lookup tables to either provide coefficients for interpolation algorithms or to initialise successive approximation algorithms.
Many attacks on cryptosystems involve precomputation.
Examples of large-scale precomputation as part of modern efficient algorithms include:
- Rainbow tables
- Perfect hashes
- The cube attack
- Precalculated BSP trees for visibility calculations in 3D graphics
- Radiosity precomputation for illumination in 3D graphics
Compilers use precomputation extensively as a means of increasing the run-time speed of the resulting code: this precomputation can be regarded as in effect a form of partial evaluation of the program code itself. Examples of this sort of precomputation include dataflow analysis and strength reduction steps.
See also
References
- ^ Jiawei Han; Micheline Kamber (9 June 2011). Data Mining: Concepts and Techniques: Concepts and Techniques. Elsevier. p. 159. ISBN 978-0-12-381480-7.
- ^ Sven Groppe (29 April 2011). Data Management and Query Processing in Semantic Web Databases. Springer Science & Business Media. p. 178. ISBN 978-3-642-19357-6.
- ^ Karen Morton; Kerry Osborne; Robyn Sands; Riyaj Shamsudeen; Jared Still (28 October 2013). Pro Oracle SQL. Apress. p. 48. ISBN 978-1-4302-6220-6.
- ^ Marie-Aude Aufaure; Esteban Zimányi (16 January 2012). Business Intelligence: First European Summer School, EBISS 2011, Paris, France, July 3-8, 2011, Tutorial Lectures. Springer Science & Business Media. p. 43. ISBN 978-3-642-27357-5.
- ^ Campbell-Kelly, Martin; Croarken, Mary; Flood, Raymond; et al., eds. (2003). The History of Mathematical Tables From Sumer to Spreadsheets. Oxford University Press. ISBN 978-0-19-850841-0.
- ^ Maher, David. W. J. and John F. Makowski. "Literary Evidence for Roman Arithmetic With Fractions", 'Classical Philology' (2001) Vol. 96 No. 4 (2001) pp. 376–399. (See page p. 383.)