Dense vector¶
The Vector
class for dense vectors. It is a subclass of std::vector<double>
.
Its purpose is to provide convenient mechanisms for performing basic vector
operations, such as constructing the vector, retrieving the size and setting the value
for a given index. The precision of the entries are double.
An example of generating a vector with size \(n\) of real double-precision numbers with value 3.14 is the following
Vector x(n, 3.14);
The underlying data storage for Vector
is std::vector<double>
.
-
class
Vector
¶ Constructors and destructors
-
Vector
()¶ It creates a default empty vector.
-
Vector
(int n)¶ A vector of size
n
is created. It allocates memory, and initializes the value to 0.
-
Vector
(int n, double val)¶ A vector of size
n
is created. It allocates memory, and initializes the value toval
.
Member functions for file I/O
-
read
(std::istream &in)¶ Read data from input stream and save the data as a Vector.
-
write
(std::ostream &out)¶ Write a Vector to a out stream with matrix market format.
-