Prefix sum

Prefix sum

The prefix sum (also known as the scan, prefix reduction, or partial sum) is an operation on lists in which each element in the result list is obtained from the sum of the elements in the operand list up to its index. There are two types of prefix sum, inclusive prefix sum and exclusive prefix sum: in the inclusive prefix sum, all the operand elements are used; whereas in the exclusive prefix sum, the first element in the result list is the identity element (0 for add operation) and the last element of the operand list is not used.

Formulae

Inclusive prefix sum:r = [a_0, a_0+a_1, a_0+a_1+a_2, ..., a_0+a_1+a_2+...+a_{n}]

Exclusive prefix sum:r = [I, a_0, a_0+a_1, a_0+a_1+a_2, ..., a_0+a_1+a_2+...+a_{n-1}]

Message Passing Interface

Scans may be performed with any associative operation applicable to the elements of the list. As an example, the operations defined by the MPI standard are:

In this case, the constants are used with the "MPI_Scan" function.

See also

* Data parallelism
* Fold (higher-order function)
* List ranking

External links

* [http://graphics.idav.ucdavis.edu/publications/print_pub?pub_id=915 Scan Primitives for GPU Computing]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • sum- — [sum] prefix SUB : used before m …   English World dictionary

  • Series (mathematics) — A series is the sum of the terms of a sequence. Finite sequences and series have defined first and last terms, whereas infinite sequences and series continue indefinitely.[1] In mathematics, given an infinite sequence of numbers { an } …   Wikipedia

  • List ranking — In parallel algorithms, the list ranking problem involves determining the position, or rank, of each item in a linked list. That is, the first item in the list should be assigned the number 1, the second item in the list should be assigned the… …   Wikipedia

  • Counting sort — In computer science, counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by counting the number of objects that have each distinct… …   Wikipedia

  • List of terms relating to algorithms and data structures — The [http://www.nist.gov/dads/ NIST Dictionary of Algorithms and Data Structures] is a reference work maintained by the U.S. National Institute of Standards and Technology. It defines a large number of terms relating to algorithms and data… …   Wikipedia

  • Scan — may refer to: *Scan, the act of examining sequentially, part by part *Image scanning, in data processing, the act of optically analyzing a two or three dimensional image and digitally encode it (digitize it) for storage in a computer file *Scan,… …   Wikipedia

  • Monoid — This article is about the mathematical concept. For the alien creatures in the Doctor Who adventure, see The Ark (Doctor Who). Coherence law for monoid unit In abstract algebra, a branch of mathematics, a monoid is an algebraic structure with a… …   Wikipedia

  • Huffman coding — Huffman tree generated from the exact frequencies of the text this is an example of a huffman tree . The frequencies and codes of each character are below. Encoding the sentence with this code requires 135 bits, as opposed of 288 bits if 36… …   Wikipedia

  • Kraft's inequality — In coding theory, Kraft s inequality, named after Leon Kraft, gives a necessary and sufficient condition for the existence of a uniquely decodable code for a given set of codeword lengths. Its applications to prefix codes and trees often find use …   Wikipedia

  • International Standard Book Number — ISBN redirects here. For usage of ISBNs in Wikipedia, see Wikipedia:ISBN. A 13 digit ISBN, 978 3 16 148410 0, as represented by an EAN 13 bar code. The International Standard Book Number (ISBN) is a unique[1][2 …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”