Class lsst::shapelet::MatrixBuilderFactory¶
-
template<typename
T
>
classMatrixBuilderFactory
¶ A factory class for MatrixBuilder, providing more control over workspace memory.
To allocate workspace manually for a MatrixBuilder, we use the following pattern:;
Because we aren’t doing anything special with the workspace, however, this is actually exactly equivalent to just constructing the MatrixBuilder directly, i.e.:MatrixBuilderFactory<T> factory(...); MatrixBuilderWorkspace<T> workspace(factory.computeWorkspace()); MatrixBuilder<T> builder = factory(workspace);
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);