42#ifndef TEUCHOS_TWODARRAY_HPP
43#define TEUCHOS_TWODARRAY_HPP
263template<
class T>
inline
265 return _data.view(_numCols*
i, _numCols);
268template<
class T>
inline
270 return _data.view(_numCols*
i, _numCols);
307 array.getDataArray().toString();
323 size_t numRows, numCols;
330 if(curPos != std::string::npos){
340 "Error: You've specified an TwoDArray as having the dimensions of "
341 << numRows <<
"x" << numCols <<
". This means you should have " <<
342 (numRows*numCols) <<
" entries specified in your array. However you "
343 "only specified " <<
array.
size() <<
" entries."
364template<
class T>
inline
370namespace TwoDDetails {
382 if(
a1.getNumRows() !=
a2.getNumRows() ||
383 a1.getNumRows() !=
a2.getNumRows())
389 for(
ST i=0;
i<
a1.getNumRows(); ++
i){
390 for(
ST j=0;
j<
a1.getNumCols()-
a1.getNumRows()+
i; ++
j){
419 if(
a1.isSymmetrical() !=
a2.isSymmetrical()){
422 if(
a1.isSymmetrical()){
426 return a1.getDataArray() ==
a2.getDataArray() &&
427 a1.getNumRows() ==
a2.getNumRows() &&
428 a1.getNumCols() ==
a2.getNumCols();
443 return "TwoDArray(*)";
451 std::string
formatString = getTwoDArrayTypeNameTraitsFormat();
Templated array class derived from the STL std::vector.
#define TEUCHOSCORE_LIB_DLL_EXPORT
Replacement for std::vector that is compatible with the Teuchos Memory Management classes.
int size(const Comm< Ordinal > &comm)
Get the number of processes in the communicator.
Concrete serial communicator subclass.
A thin wrapper around the Array class which causes it to be interpreted as a 2D Array.
void resizeRows(size_type numberOfRows)
Changes the number of rows in the matrix.
const T & operator()(size_type i, size_type j) const
Returns the element located at i,j.
size_type getNumCols() const
returns the number of columns in the TwoDArray.
static const std::string & getDimensionsDelimiter()
returns the string used as the dimension dilimeter when convering the TwoDArray to a string.
T & operator()(size_type i, size_type j)
Returns the element located at i,j.
void resizeCols(size_type numberOfCols)
Changes the number of rows in the matrix.
void clear()
delets all the entries from the TwoDArray
TwoDArray(size_type numRows, size_type numCols, Array< T > data)
size_type getNumRows() const
returns the number of rows in the TwoDArray.
std::string getTwoDArrayTypeNameTraitsFormat()
Get the format that is used for the specialization of the TypeName traits class for TwoDArray.
static const std::string & getMetaSeperator()
returns the string used to seperate meta information from actual data information when converting a T...
TwoDArray()
Constructs an empty TwoDArray.
static TwoDArray< T > fromString(const std::string &string)
Converts a valid string to it's corresponding TwoDArray.
const Array< T > & getDataArray() const
Returns the 1D array that is backing this TwoDArray.
bool isSymmetrical() const
A simple flag indicating whether or not this TwoDArray should be interpurted as symmetrical.
void setSymmetrical(bool symmetrical)
Sets whether or not the the TwoDArray should be interpurted as symetric.
static std::string toString(const TwoDArray< T > array)
Converts a given TwoDArray to a valid string representation.
TwoDArray(size_type numRows, size_type numCols, T value=T())
Constructs a TwoDArray with the given number of rows and columns with each entry being populated with...
ArrayView< T > operator[](size_type i)
Returns an ArrayView containing the contents of row i.
static std::string concreteName(const TwoDArray< T > &)
static std::string name()
Default traits class that just returns typeid(T).name().
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
bool symmetricCompare(const TwoDArray< T > &a1, const TwoDArray< T > &a2)
A function for comparing symmetrical arrarys.
std::ostream & operator<<(std::ostream &os, BigUInt< n > a)
std::istringstream & operator>>(std::istringstream &in, TwoDArray< T > &array)
bool operator==(BigUInt< n > const &a, BigUInt< n > const &b)