A sparse array of type T in 2-D. More...
#include <SparseArray2.h>
Public Types | |
| typedef Types::value_type | value_type |
| The element type of the array. | |
| typedef Types::parameter_type | parameter_type |
| The parameter type. | |
| typedef Types::unqualified_value_type | unqualified_value_type |
| The unqualified value type. | |
| typedef Types::pointer | pointer |
| A pointer to an array element. | |
| typedef Types::const_pointer | const_pointer |
| A pointer to a constant array element. | |
| typedef Types::iterator | iterator |
| An iterator in the array. | |
| typedef Types::const_iterator | const_iterator |
| A iterator on constant elements in the array. | |
| typedef Types::reference | reference |
| A reference to an array element. | |
| typedef Types::const_reference | const_reference |
| A reference to a constant array element. | |
| typedef Types::size_type | size_type |
| The size type is a signed integer. | |
| typedef Types::difference_type | difference_type |
| Pointer difference type. | |
| typedef FixedArray< 2, int > | index_type |
| A multi-index. Index in 2 dimensions. | |
Public Member Functions | |
Constructors etc. | |
| SparseArray () | |
| Default constructor. | |
| template<typename IndexBiDirIter , typename ValueForwardIter > | |
| SparseArray (IndexBiDirIter indicesBeginning, IndexBiDirIter indicesEnd, ValueForwardIter valuesBeginning, ValueForwardIter valuesEnd, parameter_type nullValue=value_type()) | |
| Construct a 2-D array sparse array from the values and indices. | |
| template<typename T2 , bool A> | |
| SparseArray (const Array< 2, T2, A > &array, parameter_type nullValue) | |
| Construct a 2-D sparse array from a 2-D dense array. | |
| SparseArray (const SparseArray &x) | |
| Copy constructor. Deep copy. | |
| ~SparseArray () | |
| Destructor. | |
Assignment operators. | |
| SparseArray & | operator= (const SparseArray &other) |
| Assignment operator. | |
Accessors. | |
| size_type | getMemoryUsage () const |
| Return the memory size. | |
| bool | isNull (const index_type &index) const |
| Return true if the element is null. | |
| bool | isNonNull (const index_type &index) const |
| Return true if the element is non-null. | |
| parameter_type | operator() (const index_type &index) const |
| Return the specified element. | |
| bool | operator== (const SparseArray &x) const |
| Return true if this sparse array is equal to the argument. | |
| bool | operator!= (const SparseArray &x) const |
| Return true if this sparse array is not equal to the argument. | |
| template<typename T2 , bool A> | |
| void | fill (ads::Array< 2, T2, A > *array) const |
| Fill a dense array with the elements from this sparse array. | |
| template<typename T2 , bool A> | |
| void | fillNonNull (ads::Array< 2, T2, A > *array) const |
| Fill a dense array using only the non-null elements from this sparse array. | |
Manipulators. | |
| void | swap (SparseArray &other) |
| Swaps data with another SparseArray. | |
Assignment operators with scalar operand. | |
| SparseArray & | operator= (parameter_type x) |
Set each component to x. | |
File I/O. | |
| void | put (std::ostream &out) const |
| Write the array to a file stream in ascii format. | |
| void | get (std::istream &in) |
| Read from a file stream in ascii format. | |
Static Public Member Functions | |
Static members. | |
| static int | getRank () |
| Return the rank (number of dimensions) of the array. | |
A sparse array of type T in 2-D.
| T | is the value type. By default it is double. |
| typedef Types::parameter_type SparseArray< 2, T >::parameter_type |
The parameter type.
This is used for passing the value type as an argument.
Reimplemented from SparseArray< 1, T >.
| typedef Types::size_type SparseArray< 2, T >::size_type |
The size type is a signed integer.
Having std::size_t (which is an unsigned integer) as the size type causes minor problems. Consult "Large Scale C++ Software Design" by John Lakos for a discussion of using unsigned integers in a class interface.
Reimplemented from SparseArray< 1, T >.
| typedef Types::unqualified_value_type SparseArray< 2, T >::unqualified_value_type |
The unqualified value type.
The value type with top level const and volatile qualifiers removed.
Reimplemented from SparseArray< 1, T >.
| SparseArray< 2, T >::SparseArray | ( | IndexBiDirIter | indicesBeginning, | |
| IndexBiDirIter | indicesEnd, | |||
| ValueForwardIter | valuesBeginning, | |||
| ValueForwardIter | valuesEnd, | |||
| parameter_type | nullValue = value_type() | |||
| ) | [inline] |
Construct a 2-D array sparse array from the values and indices.
If the null value is not specified, the default value for the type is used. For built-in types, value_type() is equivalent to value_type(0).
1.6.3