File MatrixBuilder.h¶
-
namespace
lsst
Class for a simple mapping implementing a generic AstrometryTransform.
Remove all non-astronomical counts from the Chunk Exposure’s pixels.
Forward declarations for lsst::utils::Cache
For details on the Cache class, see the Cache.h file.
It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.
A base class for image defects
Numeric constants used by the Integrate.h integrator routines.
Compute Image Statistics
- Note
Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.
- Note
The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.
-
namespace
shapelet
-
template<typename
T
>
classMatrixBuilder
- #include <MatrixBuilder.h>
Class that evaluates a (multi-)shapelet basis at predefined points.
The output “matrix” has pixels along the rows, and basis elements along columns; this is the design matrix involved in a linear least squares fit for the basis coefficients.
A MatrixBuilder can be constructed in two ways: via one of its own constructors, or via a MatrixBuilderFactory. Using the latter allows the workspace arrays used by the MatrixBuilder to be shared between instances. See MatrixBuilderFactory and MatrixBuilderWorkspace for more information.
Public Types
-
typedef MatrixBuilderFactory<T>
Factory
Factory type associated with this builder.
-
typedef MatrixBuilderWorkspace<T>
Workspace
Workspace type associated with this builder.
Public Functions
-
MatrixBuilder
(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
-
MatrixBuilder
(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
-
MatrixBuilder
(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
-
MatrixBuilder
(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.
-
ndarray::Array<T, 2, -2>
allocateOutput
() const Return a matrix appropriate for use as an output for operator().
-
void
operator()
(ndarray::Array<T, 2, -1> const &output, afw::geom::ellipses::Ellipse const &ellipse) const Fill an array with the model matrix.
- Parameters
[out] output
: Matrix to fill, with dimensions (getDataSize(), getBasisSize()). Will be zeroed before filling.[in] ellipse
: Ellipse parameters of the model, with center relative to the x and y arrays passed at construction.
Friends
-
friend
lsst::shapelet::MatrixBuilderFactory
-
typedef MatrixBuilderFactory<T>
-
template<typename
T
>
classMatrixBuilderFactory
- #include <MatrixBuilder.h>
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);
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.
Private Functions
-
PTR
(Impl)¶
-
typedef MatrixBuilderWorkspace<T>
-
template<typename
T
>
classMatrixBuilderWorkspace
- #include <MatrixBuilder.h>
Reusable, shareable workspace for MatrixBuilder.
Multiple MatrixBuilders are often used together to evaluate a multi-shapelet model, and in this case it’s more efficient for the MatrixBuilders to use the same memory for temporary arrays rather than have them each allocate their own workspace. At other times, it may be useful to use one workspace for a sequence of throwaway MatrixBuilders, to avoid unnecessary memory allocations. This class manages the memory used for a MatrixBuilder’s workspace arrays, and provides methods for tracking it and sharing it between multple MatrixBuilders. See MatrixBuilderFactory for examples.
MatrixBuilderWorkspace holds a ndarray::Manager::Ptr that “owns” the block of memory. This is passed on to any MatrixBuilders constructed with it, ensuring that the block of memory remains alive with the MatrixBuilder even if the workspace object goes out of scope - so it is not necessary to keep the workspace object alive manually for the duration of its users.
In addition, MatrixBuilderWorkspace tracks both the current point in memory, and increments this as workspace matrices and vectors are created from it. It also checks that any created arrays do not exceed the bounds of the allocated memory. In order to share workspace memory between MatrixBuilders, the workspace object is simply copied - copied objects share the same memory, but maintain different “current” pointers, and hence create arrays from the same block of memory.
Public Types
-
typedef Eigen::Map<Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic>>
Matrix
Workspace matrix type.
-
typedef Eigen::Map<Eigen::Array<T, Eigen::Dynamic, 1>>
Vector
Workspace vector type.
Public Functions
-
MatrixBuilderWorkspace
(int size) Allocate a block of memory with the given number of elements (of type T).
-
MatrixBuilderWorkspace
(MatrixBuilderWorkspace const &other) Copy the current state of the workspace, allowing multiple MatrixBuilders to start their workspace arrays at the same point in memory and hence share workspace.
See MatrixBuilderFactory for an example.
-
int
getRemaining
() const Return the size (in units of sizeof(T)) of the unused memory in the workspace.
-
Matrix
makeMatrix
(int rows, int cols) Create a matrix from the workspace memory, and increment the current location accordingly.
-
Vector
makeVector
(int size) Create a vector from the workspace memory, and increment the current location accordingly.
-
void
increment
(int size) Manually increment the current location.
-
ndarray::Manager::Ptr
getManager
() const Return the manager object that owns the block of memory.
Private Functions
-
void
operator=
(MatrixBuilderWorkspace &other)¶
-
typedef Eigen::Map<Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic>>
-
template<typename