15 srand((
unsigned) std::time(0));
21 template <
typename _Type>
23 for (std::size_t row = 0; row < A.nrows(); ++row) {
33 template <
typename _Type>
35 for (std::size_t row = 0; row < A.nrows(); ++row) {
36 if ((row + offset < A.ncols()) && (row + offset >= 0)) {
37 A(row, row + offset) = value;
45 template <
typename _Type>
47 for(std::size_t i = 0; i < X.
size(); ++i) {
55 double index = (double) rand() /
56 ((double) RAND_MAX + (
double) 1) ;
58 double x = (double) rand() /
59 ((double) RAND_MAX + (
double) 1) ;
60 V[(unsigned) index ] = x;
61 }
while(
V.nelts() < num_of_elts);
66 double index = (double) rand() /
67 ((double) RAND_MAX + (
double) 1) ;
69 double x = (double) rand() /
70 ((double) RAND_MAX + (
double) 1) ;
71 double y = (double) rand() /
72 ((double) RAND_MAX + (
double) 1) ;
73 V[(unsigned) index ] = std::complex<double>(x, y);
74 }
while(
V.nelts() < num_of_elts);
78 for(
unsigned i = 0; i <
V.size(); ++i) {
79 double x = (double) rand() /
80 ((double) RAND_MAX + (
double) 1) ;
86 for(
unsigned i = 0; i <
V.size(); ++i) {
87 double x = (double) rand() /
88 ((double) RAND_MAX + (
double) 1) ;
89 double y = (double) rand() /
90 ((double) RAND_MAX + (
double) 1) ;
91 V[ i ] = std::complex<double>(x, y);
97 for(std::size_t row = 0; row < A.nrows(); ++row) {
104 for(std::size_t row = 0; row < A.nrows(); ++row) {
105 for(std::size_t col = std::max((
int)(row - A.noffdiag()), 0);
106 (
int) col <= std::min((
int)(row + A.noffdiag()), (
int) A.ncols()); ++col) {
107 double x = (double) rand() / ((double) RAND_MAX + (
double) 1) ;
A matrix class that constructs a BANDED matrix.
A matrix class that constructs a DENSE matrix as an STL Vector of DenseVectors.
Specification for a templated DenseVector class – a dense, dynamic, vector object.
A base matrix class to ensure a consistent interface between the inheriting dense/banded matrix class...
A templated SparseVector class – a sparse, variable size, vector object.
A matrix class that constructs a BANDED matrix.
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
An DenseVector class – a dense vector object.
std::size_t size() const
A pass-thru definition to get the size of the vector.
A base matrix class for sequential matrices.
An SparseVector class – a sparse vector object.
void time_seed()
initialise RNG
void fill_random(CppNoddy::SparseVector< double > &V, const unsigned &num_of_elts)
void fill(CppNoddy::DenseVector< _Type > &X, const _Type &value)
Set all elements of a DENSE vector.
void fill_identity(CppNoddy::Sequential_Matrix_base< _Type > &A)
Fill diagonal with unit values.
void fill_band(CppNoddy::Sequential_Matrix_base< _Type > &A, const int &offset, const _Type &value)
Fill a diagonal band of a matrix.