Simple Vector based on std::vector<double>
More...
#include <VMatrix.h>
|
unsigned int | numRows |
| Number of rows.
|
|
std::vector< double > | theVec |
| Data.
|
|
Simple Vector based on std::vector<double>
Definition at line 22 of file VMatrix.h.
◆ VVector() [1/2]
gbl::VVector::VVector |
( |
const unsigned int |
nRows = 0 | ) |
|
Definition at line 224 of file VMatrix.cc.
224 :
226}
std::vector< double > theVec
Data.
unsigned int numRows
Number of rows.
◆ VVector() [2/2]
gbl::VVector::VVector |
( |
const VVector & |
aVector | ) |
|
◆ ~VVector()
gbl::VVector::~VVector |
( |
| ) |
|
|
virtual |
◆ getNumRows()
unsigned int gbl::VVector::getNumRows |
( |
| ) |
const |
Get number of rows.
- Returns
- Number of rows.
Definition at line 271 of file VMatrix.cc.
◆ getVec()
VVector gbl::VVector::getVec |
( |
unsigned int |
len, |
|
|
unsigned int |
start = 0 |
|
) |
| const |
Get part of vector.
- Parameters
-
[in] | len | Length of part. |
[in] | start | Offset of part. |
- Returns
- Part of vector.
Definition at line 251 of file VMatrix.cc.
251 {
253 std::memcpy(&aResult.theVec[0], &
theVec[start],
sizeof(
double) * len);
254 return aResult;
255}
VVector(const unsigned int nRows=0)
◆ operator()() [1/2]
double & gbl::VVector::operator() |
( |
unsigned int |
i | ) |
|
|
inline |
access element (i)
Definition at line 94 of file VMatrix.h.
◆ operator()() [2/2]
double gbl::VVector::operator() |
( |
unsigned int |
i | ) |
const |
|
inline |
access element (i)
Definition at line 99 of file VMatrix.h.
◆ operator-()
Subtraction Vector-Vector.
Definition at line 290 of file VMatrix.cc.
290 {
292 for (
unsigned int i = 0;
i <
numRows; ++
i) {
293 aResult(i) =
theVec[
i] - aVector(i);
294 }
295 return aResult;
296}
◆ operator=()
Assignment Vector=Vector.
Definition at line 299 of file VMatrix.cc.
299 {
300 if (this != &aVector) {
301 numRows = aVector.getNumRows();
303 for (
unsigned int i = 0;
i <
numRows; ++
i) {
305 }
306 }
307 return *this;
308}
◆ print()
void gbl::VVector::print |
( |
| ) |
const |
Print vector.
Definition at line 276 of file VMatrix.cc.
276 {
277 std::cout <<
" VVector: " <<
numRows << std::endl;
278 for (
unsigned int i = 0;
i <
numRows; ++
i) {
279
280 if (i % 5 == 0) {
281 std::cout << std::endl << std::setw(4) <<
i <<
"-" << std::setw(4)
282 << std::min(i + 4,
numRows) <<
":";
283 }
284 std::cout << std::setw(13) <<
theVec[
i];
285 }
286 std::cout << std::endl << std::endl;
287}
◆ putVec()
void gbl::VVector::putVec |
( |
const VVector & |
aVector, |
|
|
unsigned int |
start = 0 |
|
) |
| |
Put part of vector.
- Parameters
-
[in] | aVector | Vector with part. |
[in] | start | Offset of part. |
Definition at line 262 of file VMatrix.cc.
262 {
263 std::memcpy(&
theVec[start], &aVector.theVec[0],
264 sizeof(double) * aVector.numRows);
265}
◆ resize()
void gbl::VVector::resize |
( |
const unsigned int |
nRows | ) |
|
Resize vector.
- Parameters
-
Definition at line 240 of file VMatrix.cc.
◆ numRows
unsigned int gbl::VVector::numRows |
|
private |
Number of rows.
Definition at line 37 of file VMatrix.h.
◆ theVec
std::vector<double> gbl::VVector::theVec |
|
private |
The documentation for this class was generated from the following files: