lsst.jointcal  15.0-17-g076ea75+7
Tripletlist.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_TRIPLETLIST_H
3 #define LSST_JOINTCAL_TRIPLETLIST_H
4 
5 #include "Eigen/Sparse"
6 
7 #include <vector>
8 
9 namespace lsst {
10 namespace jointcal {
11 
12 typedef Eigen::Triplet<double> Trip;
13 
14 // at the moment this class implements the eigen format.
15 // it would be wise to implement it differently if talking to cholmod
16 class TripletList : public std::vector<Trip> {
17 public:
18  TripletList(int count) : _nextFreeIndex(0) { reserve(count); };
19 
20  void addTriplet(const unsigned i, const unsigned j, double val) { push_back(Trip(i, j, val)); }
21 
22  unsigned getNextFreeIndex() const { return _nextFreeIndex; }
23 
24  void setNextFreeIndex(unsigned index) { _nextFreeIndex = index; }
25 
26 private:
27  unsigned _nextFreeIndex;
28 };
29 } // namespace jointcal
30 } // namespace lsst
31 
32 #endif // LSST_JOINTCAL_TRIPLETLIST_H
Trip push_back(Trip ... args)
Class for a simple mapping implementing a generic Gtransfo.
void addTriplet(const unsigned i, const unsigned j, double val)
Definition: Tripletlist.h:20
STL class.
unsigned getNextFreeIndex() const
Definition: Tripletlist.h:22
void setNextFreeIndex(unsigned index)
Definition: Tripletlist.h:24
Eigen::Triplet< double > Trip
Definition: Tripletlist.h:12
Trip reserve(Trip ... args)