gslcpp
Modern-C++ Wrapper for GSL
|
Interface for every kind of vector.
More...
#include <v-iface.hpp>
|
iterator | begin () |
| Iterator that points to first element. More...
|
|
iterator | end () |
| Iterator that points to element just past last element. More...
|
|
const_iterator | begin () const |
| Iterator that points to first element. More...
|
|
const_iterator | end () const |
| Iterator that points to element just past last element. More...
|
|
size_t | size () const |
| Size of vector. More...
|
|
T * | data () |
| Pointer to first element in vector. More...
|
|
const T * | data () const |
| Pointer to first element in immutable vector. More...
|
|
T | get (size_t i) const |
| Read element with bounds-checking. More...
|
|
void | set (size_t i, T const &x) |
| Write element with bounds-checking. More...
|
|
const T & | operator[] (size_t i) const |
| Read element without bounds-checking. More...
|
|
T & | operator[] (size_t i) |
| Write element without bounds-checking. More...
|
|
T * | ptr (size_t i) |
| Retrieve pointer to i th element with bounds-checking. More...
|
|
const T * | ptr (size_t i) const |
| Retrieve pointer to i th element with bounds-checking. More...
|
|
void | set_all (T const &x) |
| Set every element. More...
|
|
void | set_zero () |
| Set every element to zero.
|
|
int | set_basis (size_t i) |
| Set element at offset i to unity and every other element to zero. More...
|
|
int | fwrite (FILE *f) const |
| Write non-portable binary-image of vector to file. More...
|
|
int | fread (FILE *f) |
| Read non-portable binary-image of vector from file. More...
|
|
int | fprintf (FILE *flp, char const *fmt) const |
| Write ASCII-formatted representation of vector to file. More...
|
|
int | fscanf (FILE *f) |
| Read ASCII-formatted representation of vector from file. More...
|
|
v_iface< element_t< T >, N, v_view > | real () |
| View of real-part of complex vector. More...
|
|
v_iface< element_t< T > const, N, v_view > | real () const |
| View of real-part of complex vector. More...
|
|
v_iface< element_t< T >, N, v_view > | imag () |
| View of imaginary-part of complex vector. More...
|
|
v_iface< element_t< T > const, N, v_view > | imag () const |
| View of imaginary-part of complex vector. More...
|
|
v_iface< T, N, v_view > | subvector (size_t n, size_t i=0, size_t s=1) |
| View of subvector of vector. More...
|
|
v_iface< T const, N, v_view > | subvector (size_t n, size_t i=0, size_t s=1) const |
| View of subvector of vector. More...
|
|
v_iface< T, N, v_view > | view () |
| View of vector. More...
|
|
v_iface< T const, N, v_view > | view () const |
| View of vector. More...
|
|
int | swap_elements (size_t i, size_t j) |
| Swap elements within this vector. More...
|
|
int | reverse () |
| Reverse order of elements. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
int | add (v_iface< T, ON, OV > const &b) |
| Add contents of b into this vector in place. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
int | sub (v_iface< T, ON, OV > const &b) |
| Subtract contents of b from this vector in place. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
int | mul (v_iface< T, ON, OV > const &b) |
| Multiply contents of b into this vector in place. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
int | div (v_iface< T, ON, OV > const &b) |
| Divide contents of b into this vector in place. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
v_iface & | operator+= (v_iface< T, ON, OV > const &b) |
| Add contents of b into this vector in place. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
v_iface & | operator-= (v_iface< T, ON, OV > const &b) |
| Subtract contents of b from this vector in place. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
v_iface & | operator*= (v_iface< T, ON, OV > const &b) |
| Multiply contents of b into this vector in place. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
v_iface & | operator/= (v_iface< T, ON, OV > const &b) |
| Divide contents of b into this vector in place. More...
|
|
template<size_t ON, template< typename, size_t > class OV> |
v_iface & | operator= (v_iface< T, ON, OV > const &b) |
| Copy contents of b into this vector. More...
|
|
v_iface & | operator= (v_iface const &b) |
| Copy contents of b into this vector. More...
|
|
| v_iface (v_iface &&)=default |
| Enable move-constructor in gsl::v_stor to work.
|
|
int | scale (T const &x) |
| Multiply scalar into this vector in place. More...
|
|
v_iface & | operator*= (T const &x) |
| Multiply scalar into this vector in place. More...
|
|
int | add_constant (T const &x) |
| Add constant into each element of this vector in place. More...
|
|
v_iface & | operator+= (T const &x) |
| Add constant into each element of this vector in place. More...
|
|
T | sum () const |
| Sum of elements. More...
|
|
T | max () const |
| Greatest value of any element. More...
|
|
T | min () const |
| Least value of any element. More...
|
|
void | minmax (T &min, T &max) const |
| Greatest value and least value of any element. More...
|
|
size_t | max_index () const |
| Offset of greatest value. More...
|
|
size_t | min_index () const |
| Offset of least value. More...
|
|
void | minmax_index (size_t &imin, size_t &imax) const |
| Offset of least value and offset of greatest value. More...
|
|
bool | isnull () const |
| True only if every element have zero value. More...
|
|
bool | ispos () const |
| True only if every element be positive. More...
|
|
bool | isneg () const |
| True only if every element be negative. More...
|
|
bool | isnonneg () const |
| True only if every element be non-negative. More...
|
|
template<typename T, size_t N, template< typename, size_t > class S>
struct gsl::v_iface< T, N, S >
Interface for every kind of vector.
- Template Parameters
-
T | Type of each element in vector. |
N | Compile-time number of elements (0 means set at run-time). |
S | Type specifying interface to storage of elements. |
Definition at line 62 of file v-iface.hpp.
◆ anonymous enum
template<typename T , size_t N, template< typename, size_t > class S>
Enumerator |
---|
SIZE | Size at compile-time.
|
Definition at line 70 of file v-iface.hpp.
◆ add()
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Add contents of b
into this vector in place.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Vector whose contents should be added into this. |
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 247 of file v-iface.hpp.
248 static_assert(N == ON || N == 0 || ON == 0);
249 return w_add(v(), b.v());
◆ add_constant()
template<typename T , size_t N, template< typename, size_t > class S>
Add constant into each element of this vector in place.
- Parameters
-
x | Constant to add into this vector. |
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 372 of file v-iface.hpp.
◆ begin() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
Iterator that points to first element.
- Returns
- Iterator that points to first element.
Definition at line 83 of file v-iface.hpp.
◆ begin() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
Iterator that points to first element.
- Returns
- Iterator that points to first element.
Definition at line 91 of file v-iface.hpp.
◆ data() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
Pointer to first element in vector.
- Be careful to check
v()->stride
in case data be not contiguous. - Returns
- Pointer to first element.
Definition at line 104 of file v-iface.hpp.
104 {
return (T *)v()->data; }
◆ data() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
Pointer to first element in immutable vector.
- Be careful to check
v()->stride
in case data be not contiguous. - Returns
- Pointer to first immutable element.
Definition at line 109 of file v-iface.hpp.
110 return (T
const *)v()->data;
◆ div()
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Divide contents of b
into this vector in place.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Vector whose contents should be divided into this. |
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 280 of file v-iface.hpp.
281 static_assert(N == ON || N == 0 || ON == 0);
282 return w_div(v(), b.v());
◆ end() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
Iterator that points to element just past last element.
- Returns
- Iterator that points to element just past last element.
Definition at line 87 of file v-iface.hpp.
◆ end() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
Iterator that points to element just past last element.
- Returns
- Iterator that points to element just past last element.
Definition at line 95 of file v-iface.hpp.
◆ fprintf()
template<typename T , size_t N, template< typename, size_t > class S>
int gsl::v_iface< T, N, S >::fprintf |
( |
FILE * |
flp, |
|
|
char const * |
fmt |
|
) |
| const |
|
inline |
Write ASCII-formatted representation of vector to file.
- Parameters
-
flp | Pointer to structure for buffered interface. |
fmt | printf()-style format-string. |
- Returns
- Zero only on success.
Definition at line 171 of file v-iface.hpp.
◆ fread()
template<typename T , size_t N, template< typename, size_t > class S>
Read non-portable binary-image of vector from file.
- Parameters
-
f | Pointer to structure for buffered interface. |
- Returns
- Zero only on success.
Definition at line 165 of file v-iface.hpp.
◆ fscanf()
template<typename T , size_t N, template< typename, size_t > class S>
Read ASCII-formatted representation of vector from file.
- Parameters
-
f | Pointer to structure for buffered interface. |
- Returns
- Zero only on success.
Definition at line 178 of file v-iface.hpp.
◆ fwrite()
template<typename T , size_t N, template< typename, size_t > class S>
Write non-portable binary-image of vector to file.
- Parameters
-
f | Pointer to structure for buffered interface. |
- Returns
- Zero only on success.
Definition at line 160 of file v-iface.hpp.
◆ get()
template<typename T , size_t N, template< typename, size_t > class S>
Read element with bounds-checking.
- Parameters
-
- Returns
- Value of element.
Definition at line 116 of file v-iface.hpp.
116 {
return w_get(v(), i); }
◆ imag() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
View of imaginary-part of complex vector.
- Returns
- View of imaginary-part of complex vector.
Definition at line 190 of file v-iface.hpp.
◆ imag() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
View of imaginary-part of complex vector.
- Returns
- View of imaginary-part of complex vector.
Definition at line 194 of file v-iface.hpp.
◆ isneg()
template<typename T , size_t N, template< typename, size_t > class S>
True only if every element be negative.
- Returns
- True only if every element be negative.
Definition at line 424 of file v-iface.hpp.
◆ isnonneg()
template<typename T , size_t N, template< typename, size_t > class S>
True only if every element be non-negative.
- Returns
- True only if every element be non-negative.
Definition at line 428 of file v-iface.hpp.
◆ isnull()
template<typename T , size_t N, template< typename, size_t > class S>
True only if every element have zero value.
- Returns
- True only if every element be zero.
Definition at line 416 of file v-iface.hpp.
◆ ispos()
template<typename T , size_t N, template< typename, size_t > class S>
True only if every element be positive.
- Returns
- True only if every element be positive.
Definition at line 420 of file v-iface.hpp.
◆ max()
template<typename T , size_t N, template< typename, size_t > class S>
Greatest value of any element.
- Returns
- Greatest value of any element.
Definition at line 388 of file v-iface.hpp.
388 {
return w_max(v()); }
◆ max_index()
template<typename T , size_t N, template< typename, size_t > class S>
Offset of greatest value.
- Returns
- Offset of greatest value.
Definition at line 401 of file v-iface.hpp.
◆ min()
template<typename T , size_t N, template< typename, size_t > class S>
Least value of any element.
- Returns
- Least value of any element.
Definition at line 392 of file v-iface.hpp.
392 {
return w_min(v()); }
◆ min_index()
template<typename T , size_t N, template< typename, size_t > class S>
Offset of least value.
- Returns
- Offset of least value.
Definition at line 405 of file v-iface.hpp.
◆ minmax()
template<typename T , size_t N, template< typename, size_t > class S>
void gsl::v_iface< T, N, S >::minmax |
( |
T & |
min, |
|
|
T & |
max |
|
) |
| const |
|
inline |
Greatest value and least value of any element.
- Parameters
-
min | On return, least value. |
max | On return, greatest value. |
Definition at line 397 of file v-iface.hpp.
◆ minmax_index()
template<typename T , size_t N, template< typename, size_t > class S>
void gsl::v_iface< T, N, S >::minmax_index |
( |
size_t & |
imin, |
|
|
size_t & |
imax |
|
) |
| const |
|
inline |
Offset of least value and offset of greatest value.
- Parameters
-
imin | On return, offset of least value. |
imax | On return, offset of greatest value. |
Definition at line 410 of file v-iface.hpp.
◆ mul()
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Multiply contents of b
into this vector in place.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Vector whose contents should be multiplied into this. |
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 269 of file v-iface.hpp.
270 static_assert(N == ON || N == 0 || ON == 0);
271 return w_mul(v(), b.v());
◆ operator*=() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
Multiply scalar into this vector in place.
- Parameters
-
x | Scalar to multiply into this. |
- Returns
- Reference to this vector after modification.
Definition at line 364 of file v-iface.hpp.
◆ operator*=() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Multiply contents of b
into this vector in place.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Vector whose contents should be multiplied into this. |
- Returns
- Reference to this vector after modification.
Definition at line 315 of file v-iface.hpp.
316 static_assert(N == ON || N == 0 || ON == 0);
◆ operator+=() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
Add constant into each element of this vector in place.
- Parameters
-
x | Constant to add into this vector. |
- Returns
- Reference to this vector after modification.
Definition at line 377 of file v-iface.hpp.
◆ operator+=() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Add contents of b
into this vector in place.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Vector whose contents should be added into this. |
- Returns
- Reference to this vector after modification.
Definition at line 291 of file v-iface.hpp.
292 static_assert(N == ON || N == 0 || ON == 0);
◆ operator-=()
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Subtract contents of b
from this vector in place.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Vector whose contents should be subtracted from this. |
- Returns
- Reference to this vector after modification.
Definition at line 303 of file v-iface.hpp.
304 static_assert(N == ON || N == 0 || ON == 0);
◆ operator/=()
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Divide contents of b
into this vector in place.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Vector whose contents should be divided into this. |
- Returns
- Reference to this vector after modification.
Definition at line 327 of file v-iface.hpp.
328 static_assert(N == ON || N == 0 || ON == 0);
◆ operator=() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
Copy contents of b
into this vector.
- Parameters
-
b | Reference to vector whose data will be copied. |
- Returns
- Reference to this instance after assignment.
Definition at line 348 of file v-iface.hpp.
◆ operator=() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Copy contents of b
into this vector.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Reference to vector whose data will be copied. |
- Returns
- Reference to this instance after assignment.
Definition at line 339 of file v-iface.hpp.
340 static_assert(N == ON || N == 0 || ON == 0);
◆ operator[]() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
Write element without bounds-checking.
- Parameters
-
- Returns
- Reference to mutable element.
Definition at line 131 of file v-iface.hpp.
131 {
return data()[i * v()->stride]; }
◆ operator[]() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
const T& gsl::v_iface< T, N, S >::operator[] |
( |
size_t |
i | ) |
const |
|
inline |
Read element without bounds-checking.
- Parameters
-
- Returns
- Reference to immutable element.
Definition at line 126 of file v-iface.hpp.
126 {
return data()[i * v()->stride]; }
◆ ptr() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
Retrieve pointer to i
th element with bounds-checking.
This could be useful if stride unknown.
- Parameters
-
- Returns
- Pointer to mutable element.
Definition at line 137 of file v-iface.hpp.
137 {
return w_ptr(v(), i); }
◆ ptr() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
Retrieve pointer to i
th element with bounds-checking.
This could be useful if stride unknown.
- Parameters
-
- Returns
- Pointer to immutable element.
Definition at line 143 of file v-iface.hpp.
143 {
return w_ptr(v(), i); }
◆ real() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
View of real-part of complex vector.
- Returns
- View of real-part of complex vector.
Definition at line 182 of file v-iface.hpp.
◆ real() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
View of real-part of complex vector.
- Returns
- View of real-part of complex vector.
Definition at line 186 of file v-iface.hpp.
◆ reverse()
template<typename T , size_t N, template< typename, size_t > class S>
Reverse order of elements.
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 239 of file v-iface.hpp.
◆ scale()
template<typename T , size_t N, template< typename, size_t > class S>
Multiply scalar into this vector in place.
- Parameters
-
x | Scalar to multiply into this. |
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 359 of file v-iface.hpp.
◆ set()
template<typename T , size_t N, template< typename, size_t > class S>
Write element with bounds-checking.
- Parameters
-
i | Offset of element. |
x | New value for element. |
Definition at line 121 of file v-iface.hpp.
121 {
w_set(v(), i, x); }
◆ set_all()
template<typename T , size_t N, template< typename, size_t > class S>
Set every element.
- Parameters
-
x | Value to which each element should be set. |
Definition at line 147 of file v-iface.hpp.
◆ set_basis()
template<typename T , size_t N, template< typename, size_t > class S>
Set element at offset i
to unity and every other element to zero.
- Parameters
-
i | Offset of element set to unity. |
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 155 of file v-iface.hpp.
◆ size()
template<typename T , size_t N, template< typename, size_t > class S>
Size of vector.
- Returns
- Size of vector.
Definition at line 99 of file v-iface.hpp.
◆ sub()
template<typename T , size_t N, template< typename, size_t > class S>
template<size_t ON, template< typename, size_t > class OV>
Subtract contents of b
from this vector in place.
- Template Parameters
-
ON | Compile-time number of elements in b . |
OV | Type of interface to storage for b . |
- Parameters
-
b | Vector whose contents should be subtracted from this. |
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 258 of file v-iface.hpp.
259 static_assert(N == ON || N == 0 || ON == 0);
260 return w_sub(v(), b.v());
◆ subvector() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
View of subvector of vector.
Arguments are reordered from those given to gsl_vector_subvector_with_stride(). Putting initial offset and stride at end allows each to have good default (0 for initial offset and 1 for stride).
- Parameters
-
n | Number of elements in view. |
i | Offset in vector of first element in view. |
s | Stride of view relative to vector. |
- Returns
- View of subvector.
Definition at line 204 of file v-iface.hpp.
◆ subvector() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
View of subvector of vector.
Arguments are reordered from those given to gsl_vector_subvector_with_stride(). Putting initial offset and stride at end allows each to have good default (0 for initial offset and 1 for stride).
- Parameters
-
n | Number of elements in view. |
i | Offset in vector of first element in view. |
s | Stride of view relative to vector. |
- Returns
- View of subvector.
Definition at line 217 of file v-iface.hpp.
◆ sum()
template<typename T , size_t N, template< typename, size_t > class S>
Sum of elements.
- Returns
- Sum of elements.
Definition at line 384 of file v-iface.hpp.
384 {
return w_sum(v()); }
◆ swap_elements()
template<typename T , size_t N, template< typename, size_t > class S>
int gsl::v_iface< T, N, S >::swap_elements |
( |
size_t |
i, |
|
|
size_t |
j |
|
) |
| |
|
inline |
Swap elements within this vector.
- Parameters
-
i | Offset of one element. |
j | Offset of other element. |
- Returns
- TBD: GSL's documentation does not specify.
Definition at line 235 of file v-iface.hpp.
◆ view() [1/2]
template<typename T , size_t N, template< typename, size_t > class S>
View of vector.
- Returns
- View of vector.
Definition at line 223 of file v-iface.hpp.
◆ view() [2/2]
template<typename T , size_t N, template< typename, size_t > class S>
View of vector.
- Returns
- View of vector.
Definition at line 227 of file v-iface.hpp.
The documentation for this struct was generated from the following file:
auto w_min(w_vector< double const > *v)
Minimum value in vector v.
auto w_get(w_vector< double const > *v, size_t i)
Return ith element of vector v with bounds-checking.
int add(v_iface< T, ON, OV > const &b)
Add contents of b into this vector in place.
void w_minmax_index(w_vector< double const > *v, size_t *min, size_t *max)
Return indices of minimum and maximum values in vector v.
void w_minmax(w_vector< double const > *v, double *min, double *max)
Return minimum and maximum values in vector v.
v_iterator< v_iface > iterator
Type of iterator that points to mutable element.
int w_div(w_vector< double > *u, w_vector< double const > *v)
Perform the logical operation u = u/v element by element.
auto w_max_index(w_vector< double const > *v)
Index of maximum value in vector v.
int w_add(w_vector< double > *u, w_vector< double const > *v)
Element by element, accumulate v into u.
int sub(v_iface< T, ON, OV > const &b)
Subtract contents of b from this vector in place.
auto w_real(w_vector< double > *v)
Real part (identity-view) of real vector.
int w_sub(w_vector< double > *u, w_vector< double const > *v)
For vectors u and v, obtain effect u = u - v.
void w_set_all(w_vector< double > *v, double const &x)
Set every element of vector v to same value x.
int w_reverse(w_vector< double > *v)
Reverse order of elements in vector v.
auto w_min_index(w_vector< double const > *v)
Index of minimum value in vector v.
int w_fwrite(FILE *f, w_vector< double const > *v)
Write elements of vector v to stream f in binary format.
int w_scale(w_vector< double > *u, double const &v)
For vector u and scalar v, produce effect of u = u * v.
T max() const
Greatest value of any element.
auto w_max(w_vector< double const > *v)
Maximum value in vector v.
v_iterator< v_iface const > const_iterator
Type of iterator that points to immutable element.
bool w_ispos(w_vector< double const > *v)
True only if every element in vector v be positive.
T min() const
Least value of any element.
size_t size() const
Size of vector.
auto w_subvector(w_vector< double > *v, size_t i, size_t s, size_t n)
View of subvector of vector v.
T * data()
Pointer to first element in vector.
int div(v_iface< T, ON, OV > const &b)
Divide contents of b into this vector in place.
int w_mul(w_vector< double > *u, w_vector< double const > *v)
For vectors u and v, produce, element by element, u = u * v.
int scale(T const &x)
Multiply scalar into this vector in place.
int w_add_constant(w_vector< double > *u, double const &v)
Add same constant to every element in place.
int w_fprintf(FILE *f, w_vector< double const > *v, char const *fmt)
Write elements of v line by line to stream f via specifier fmt.
bool w_isneg(w_vector< double const > *v)
True only if every element of vector v be negative.
@ SIZE
Size at compile-time.
int w_set_basis(w_vector< double > *v, size_t i)
Make basis-vector by setting every element in v to zero except for ith element, which is set to unity...
int add_constant(T const &x)
Add constant into each element of this vector in place.
int w_swap_elements(w_vector< double > *v, size_t i, size_t j)
Exchange ith and jth elements in vector v.
int w_fread(FILE *f, w_vector< double > *v)
Read into v from stream f in binary format.
auto w_sum(w_vector< double const > *v)
Sum of elements in vector v.
int mul(v_iface< T, ON, OV > const &b)
Multiply contents of b into this vector in place.
void w_set(w_vector< double > *v, size_t i, double const &x)
Set to x the value of ith element of vector v.
auto * w_ptr(w_vector< double > *v, size_t i)
Pointer to ith element of vector v, with bounds-checking.
bool w_isnonneg(w_vector< double const > *v)
True only if every element of vector v be non-negative.
int w_fscanf(FILE *f, w_vector< double > *v)
Read formatted data from stream f into vector v.
auto w_imag(w_vector< complex< double >> *u)
Imaginary-part of complex vector.
int memcpy(v_iface< T1, N1, V1 > &dst, v_iface< T2, N2, V2 > const &src)
Copy data from src, whose length must be same as that of dst.
bool w_isnull(w_vector< double const > *v)
True only if every element in vector v be zero.