Reductions

This module provides various reductions from matrices and vectors to scalars and from matrices to to vectors.

ceygen.reductions.sum_v(x)

Return sum of the vector x.

Parameters:x (dtype[:]) – vector to sum up
Raises :ValueError if argument dimensions aren’t appropriate for this operation or if arguments are otherwise invalid.
Raises :TypeError if you pass an argument that doesn’t support buffer interface (e.g. a plain list). Use preferrably a Cython memoryview and resort to Python array, Cython array or a NumPy array.
Return type:dtype
ceygen.reductions.sum_m(x)

Return sum of the matrix x.

Parameters:x (dtype[:, :]) – matrix to sum up
Raises :ValueError if argument dimensions aren’t appropriate for this operation or if arguments are otherwise invalid.
Raises :TypeError if you pass an argument that doesn’t support buffer interface (e.g. a plain list). Use preferrably a Cython memoryview and resort to Python array, Cython array or a NumPy array.
Return type:dtype
ceygen.reductions.rowwise_sum(x[, out])

Compute sum of the invidual rows of matrix x.

Parameters:
  • x (dtype[:, :]) – matrix to sum up
  • out (dtype[:]) – memory view to write the result to. Specifying this optional argument means that Ceygen doesn’t have to allocate memory for the result (allocating memory involves acquiring the GIL and calling many expensive Python functions). Once specified, it must must have correct dimensions to store the result of this operation (otherwise you get ValueError); the same out instance will be also returned. Warning: don’t repeat x (or y) here, it would give incorrect result without any error. Perhaps there’s an in-place variant instead?
Raises :

ValueError if argument dimensions aren’t appropriate for this operation or if arguments are otherwise invalid.

Raises :

TypeError if you pass an argument that doesn’t support buffer interface (e.g. a plain list). Use preferrably a Cython memoryview and resort to Python array, Cython array or a NumPy array.

Return type:

dtype[:]

ceygen.reductions.colwise_sum(x[, out])

Compute sum of the invidual columns of matrix x.

Parameters:
  • x (dtype[:, :]) – matrix to sum up
  • out (dtype[:]) – memory view to write the result to. Specifying this optional argument means that Ceygen doesn’t have to allocate memory for the result (allocating memory involves acquiring the GIL and calling many expensive Python functions). Once specified, it must must have correct dimensions to store the result of this operation (otherwise you get ValueError); the same out instance will be also returned. Warning: don’t repeat x (or y) here, it would give incorrect result without any error. Perhaps there’s an in-place variant instead?
Raises :

ValueError if argument dimensions aren’t appropriate for this operation or if arguments are otherwise invalid.

Raises :

TypeError if you pass an argument that doesn’t support buffer interface (e.g. a plain list). Use preferrably a Cython memoryview and resort to Python array, Cython array or a NumPy array.

Return type:

dtype[:]

Previous topic

Cholesky Decomposition-powered Functions

Next topic

Ceygen Development

This Page