Template Class MatrixBuilderFactory

Class Documentation

template<typename T>
class MatrixBuilderFactory

A factory class for MatrixBuilder, providing more control over workspace memory.

To allocate workspace manually for a MatrixBuilder, we use the following pattern:;

MatrixBuilderFactory<T> factory(...);
MatrixBuilderWorkspace<T> workspace(factory.computeWorkspace());
MatrixBuilder<T> builder = factory(workspace);
Because we aren’t doing anything special with the workspace, however, this is actually exactly equivalent to just constructing the MatrixBuilder directly, i.e.:
MatrixBuilder<T> builder(...);

A more interesting case is if we want to use the same workspace for a pair of MatrixBuilders:

MatrixBuilderFactory<T> factory1(...);
MatrixBuilderFactory<T> factory2(...);
MatrixBuilderWorkspace<T> workspace1(
   std::max(factory1.computeWorkspace(), factory2.computeWorkspace())
);
MatrixBuilderWorkspace<T> workspace2(workspace1);
MatrixBuilder<T> builder1 = factory1(workspace1);
MatrixBuilder<T> builder2 = factory2(workspace2);

Public Types

typedef MatrixBuilderWorkspace<T> Workspace

Associated workspace class.

typedef MatrixBuilder<T> Builder

Associated builder class.

Public Functions

MatrixBuilderFactory(ndarray::Array<T const, 1, 1> const &x, ndarray::Array<T const, 1, 1> const &y, int order)

Create a MatrixBuilder that evaluates a simple non-compound shapelet basis.

Parameters
  • [in] x: column positions at which the basis should be evaluated.

  • [in] y: row positions at which the basis should be evaluated (same size as x).

  • [in] order: order of the shapelet basis

MatrixBuilderFactory(ndarray::Array<T const, 1, 1> const &x, ndarray::Array<T const, 1, 1> const &y, int order, ShapeletFunction const &psf)

Create a MatrixBuilder that evaluates a simple non-compound shapelet basis after convolving it with a ShapeletFunction.

Parameters
  • [in] x: column positions at which the basis should be evaluated.

  • [in] y: row positions at which the basis should be evaluated (same size as x).

  • [in] order: order of the shapelet basis

  • [in] psf: function to convolve the basis with

MatrixBuilderFactory(ndarray::Array<T const, 1, 1> const &x, ndarray::Array<T const, 1, 1> const &y, MultiShapeletBasis const &basis)

Create a MatrixBuilder that evaluates a MultiShapeletBasis object.

Parameters
  • [in] x: column positions at which the basis should be evaluated.

  • [in] y: row positions at which the basis should be evaluated (same size as x).

  • [in] basis: basis object defining the functions the matrix evaluates

MatrixBuilderFactory(ndarray::Array<T const, 1, 1> const &x, ndarray::Array<T const, 1, 1> const &y, MultiShapeletBasis const &basis, MultiShapeletFunction const &psf)

Create a MatrixBuilder that evaluates a MultiShapeletBasis object after convolving it with a MultiShapeletFunction.

Parameters
  • [in] x: column positions at which the basis should be evaluated.

  • [in] y: row positions at which the basis should be evaluated (same size as x).

  • [in] basis: basis object defining the functions the matrix evaluates

  • [in] psf: function to convolve the basis with

int getDataSize() const

Return the number of data points.

int getBasisSize() const

Return the number of basis elements.

int computeWorkspace() const

Return the size of the workspace needed for this MatrixBuilder, in elements of T.

MatrixBuilder<T> operator()() const

Return a new MatrixBuilder with internal, unshared workspace.

MatrixBuilder<T> operator()(Workspace &workspace) const

Return a new MatrixBuilder using the given workspace.