71 template<
typename T, K_UINT_32 BEG,
bool DBG>
139 inline void get(std::istream& is);
142 inline void put(std::ostream& os)
const;
169 template<
typename T, K_UINT_32 BEG,
bool DBG>
170 inline std::istream&
operator>>(std::istream& is,
174 template<
typename T, K_UINT_32 BEG,
bool DBG>
175 inline std::ostream&
operator<<(std::ostream& os,
186 std::string rowDelim =
"\n",
187 std::string startDelim =
"",
188 std::string endDelim =
"",
K_UINT_32 nrow() const
Returns m_, the number of rows of the matrix.
void swap(KMatrix &M)
Constant-time swap function between two matrices.
KMatrix()
Default constructor. Creates an empty matrix.
Contains the implementation of the KMatrix template class.
K_UINT_32 n_
Number of columns of matrix.
unsigned short KMatrixContext
Handle type to a matrix printing context.
KMatrix & operator=(const T &a)
Assigns a copy of a to all elements of the matrix.
T type
Type of objects contained in the matrix.
KMatrixContext createKMatrixContext(std::string elemDelim=" ", std::string rowDelim="\n", std::string startDelim="", std::string endDelim="", unsigned prec=4)
Creates a matrix printing context.
void assign(K_UINT_32 m, K_UINT_32 n, const T *v)
Copies a C-style array of instances of T in an m by n matrix.
KMatrixContext DEFAULT_MATRIX_CONTEXT
Default matrix printing context object.
void init(K_UINT_32 m, K_UINT_32 n)
Helper function to initialize matrix.
std::vector< T * > vimpl_
Array of pointers to rows of Mimpl_.
Starting index of matrix, either 0 or 1.
K_UINT_32 m_
Number of rows of matrix.
unsigned long int K_UINT_32
Unsigned 32-bits integral type.
T & operator()(K_UINT_32 i, K_UINT_32 j)
Returns the element (i,j).
Contains type definitions specific to each platform.
void resize(K_UINT_32 m, K_UINT_32 n)
Resizes the matrix. Resulting matrix contents are undefined.
Minimalist matrix template class.
std::ostream & operator<<(std::ostream &os, const KMatrix< T, BEG, DBG > &M)
Writes a matrix to a stream.
void put(std::ostream &os) const
Writes a matrix to a stream.
K_UINT_32 ncol() const
Returns n_, the number of columns of the matrix.
std::vector< T > Mimpl_
Underlying vector implementation.
KMatrixContext selectKMatrixContext(KMatrixContext c)
Selects a matrix printing context as the current context.
std::istream & operator>>(std::istream &is, KMatrix< T, BEG, DBG > &M)
Reads a matrix from a stream.
T ** M_
Pointer to the start of vimpl_.