General purpose algorithms.
Bases: Computation
A general class for pure parallel computations (i.e. with no interaction between threads).
Parameters: 


Parameters:  args – corresponds to the given parameters. 

Creates a PureParallel instance from a Transformation object. guiding_array can be a string with a name of an array parameter from trf, or the corresponding TransformationParameter object.
Bases: Computation
Changes the order of axes in a multidimensional array. Works analogous to numpy.transpose.
Parameters: 


Parameters: 


A predicate used in Reduce.
Parameters: 


Bases: Computation
Reduces the array over given axis using given binary operation.
Parameters: 


Parameters: 


Linear algebra algorithms.
Bases: Computation
Multiplies two matrices using last two dimensions and batching over remaining dimensions. For batching to work, the products of remaining dimensions should be equal (then the multiplication will be performed piecewise), or one of them should equal 1 (then the multiplication will be batched over the remaining dimensions of the other matrix).
Parameters: 


Parameters: 


Bases: Computation
Calculates the entrywise matrix norm (same as numpy.linalg.norm) of an arbitrary order \(r\):
Parameters: 


Parameters: 


Bases: Computation
Performs the Fast Fourier Transform. The interface is similar to numpy.fft.fftn. The inverse transform is normalized so that IFFT(FFT(X)) = X.
Parameters: 


Note
Current algorithm works most effectively with array dimensions being power of 2 This mostly applies to the axes over which the transform is performed, beacuse otherwise the computation falls back to the Bluestein’s algorithm, which effectively halves the performance.
output and input may be the same array.
Parameters: 


Returns the spatial grid required to calculate the order power of a function defined in the harmonic mode space of the size modes. If add_points is 0, the grid has the minimum size required for exact transformation back to the mode space.
Returns an eigenfunction of order \(n = \mathrm{mode}\) for the harmonic oscillator:
where \(H_n\) is the \(n\)th order “physicists’” Hermite polynomial. The normalization is chosen so that \(\int \phi_n^2(x) dx = 1\).
Bases: Computation
Discrete transform to and from harmonic oscillator modes. With inverse=True transforms a function defined by its expansion \(C_m,\,m=0 \ldots M1\) in the mode space with mode functions from harmonic(), to the coordinate space (\(F(x)\) on the grid \(x\) from get_spatial_grid()). With inverse=False guarantees to recover first \(M\) modes of \(F^k(x)\), where \(k\) is the order parameter.
For multiple dimensions the operation is the same, and the mode functions are products of 1D mode functions, i.e. \(\phi_{l,m,n}^{3D}(x,y,z) = \phi_l(x) \phi_m(y) \phi_n(z)\).
For the detailed description of the algorithm, see Dion & Cances, PRE 67(4) 046706 (2003)
Parameters: 


Depending on inverse value, either of these two will be created.
Parameters: 


This module is based on the paper by Salmon et al., P. Int. C. High. Perform. 16 (2011). and the source code of Random123 library.
A counterbased randomnumber generator (CBRNG) is a parametrized function \(f_k(c)\), where \(k\) is the key, \(c\) is the counter, and the function \(f_k\) defines a bijection in the set of integer numbers. Being applied to successive counters, the function produces a sequence of pseudorandom numbers. The key is an analogue of the seed of stateful RNGs; if the CBRNG is used to generate random num bers in parallel threads, the key is a combination of a seed and a unique thread number.
There are two types of generators available, threefry (uses large number of simple functions), and philox (uses smaller number of more complicated functions). The latter one is generally faster on GPUs; see the paper above for detailed comparisons. These generators can be further specialized to use words=2 or words=4 bitness=32bit or bitness=64bit counters. Obviously, the period of the generator equals to the cardinality of the set of possible counters. For example, if the counter consits of 4 64bit numbers, then the period of the generator is \(2^{256}\). As for the key size, in case of threefry the key has the same size as the counter, and for philox the key is half its size.
The CBRNG class sets one of the words of the key (except for philox2x64, where 32 bit of the only word in the key are used), the rest are the same for all threads and are derived from the provided seed. This limits the maximum number of numbergenerating threads (size). philox2x32 has a 32bit key and therefore cannot be used in CBRNG (although it can be used separately with the help of the kernel API).
The CBRNG class itself is stateless, same as other computations in Reikna, so you have to manage the generator state yourself. The state is created by the create_counters() method and contains a size counters. This state is then passed to, and updated by a CBRNG object.
Bases: Computation
Counterbased pseudorandom number generator class.
Parameters: 


A convenience constructor for the sampler sampler_name from samplers. The contents of the dictionary sampler_kwds will be passed to the sampler constructor function (with bijection being created automatically, and dtype taken from randoms_arr).
Parameters: 


Contains a CBRNG bijection module and accompanying metadata. Supports __process_modules__ protocol.
The data type of the integer word used by the generator.
The number of words used by the key.
The number of words used by the counter.
The numpy.dtype object representing a bijection key. Contains a single array field v with key_words of word_dtype elements.
The numpy.dtype object representing a bijection counter. Contains a single array field v with key_words of word_dtype elements.
A dictionary dtype:function_name of available functions function_name in module that produce a random fullrange integer dtype from a State, advancing it. Available functions: get_raw_uint32(), get_raw_uint64().
The module containing the CBRNG function. It provides the C functions below.
Contains the value of counter_words.
Contains the type corresponding to word_dtype.
Describes the bijection key. Alias for the structure generated from key_dtype.
Describes the bijection counter, or its output. Alias for the structure generated from counter_dtype.
Extracts a counter which has not been used in random sampling.
A type of unsigned 32bit word, corresponds to numpy.uint32.
A type of unsigned 64bit word, corresponds to numpy.uint64.
A CBRNG based on a low number of slow rounds (multiplications).
Parameters: 


Returns:  a Bijection object. 
A CBRNG based on a big number of fast rounds (bit rotations).
Parameters: 


Returns:  a Bijection object. 
Contains a random distribution sampler module and accompanying metadata. Supports __process_modules__ protocol.
If True, every sampled random number consumes the same amount of counters.
How many random numbers one call to sample creates.
The data type of one random value produced by the sampler.
The module containing the distribution sampling function. It provides the C functions below.
Contains the value of randoms_per_call.
Describes the sampling result.
Generates random numbers from the gamma distribution
where \(k\) is shape, and \(\theta\) is scale. Supported dtypes: float(32/64). Returns a Sampler object.
Generates normally distributed random numbers with the mean mean and the standard deviation std using BoxMuller transform. Supported dtypes: float(32/64), complex(64/128). Produces two random numbers per call for real types and one number for complex types. Returns a Sampler object.
Note
In case of a complex dtype, std refers to the standard deviation of the complex numbers (same as numpy.std() returns), not real and imaginary components (which will be normally distributed with the standard deviation std / sqrt(2)). Consequently, while mean is of type dtype, std must be real.
Generates uniformly distributed floatingpoints numbers in the interval [low, high). Supported dtypes: float(32/64). A fixed number of counters is used in each thread. Returns a Sampler object.
Generates uniformly distributed integer numbers in the interval [low, high). If high is None, the interval is [0, low). Supported dtypes: any numpy integers. If the size of the interval is a power of 2, a fixed number of counters is used in each thread. Returns a Sampler object.
Contains a key generator module and accompanying metadata. Supports __process_modules__ protocol.
A module with the key generator function:
Generates and returns a key, suitable for the bijection which was given to the constructor.
Creates a generator.
Parameters: 


Reference function that returns the key given the thread identifier. Uses the same algorithm as the module.