46 bvec
temp(1 << (m - 1));
51 for (
int i = 0;
i < m - 1;
i++) {
85 it_assert(n > 0,
"waterfilling(): alpha vector cannot have zero length");
86 it_assert(
P > 0,
"waterfilling(): Power constraint must be positive");
88 ivec
ind = sort_index(alpha);
89 it_assert(alpha(
ind(0)) > 0,
"waterfilling(): Gains must be positive");
93 for (
int m = 0; m < n; m++) {
96 for (
int j = m;
j < n;
j++) {
97 t += 1.0 / alpha(
ind(
j));
99 t = (t +
P) / (n - m);
106 for (
int j = 0;
j < n;
j++) {
int size() const
Returns the number of data elements in the array object.
Binary arithmetic (boolean) class.
Definitions of some specific functions useful in communications.
Definitions of converters between different vector and matrix types.
#define it_assert_debug(t, s)
Abort if t is not true and NDEBUG is not defined.
#define it_assert(t, s)
Abort if t is not true.
int length(const Vec< T > &v)
Length of vector.
vec waterfilling(const vec &alpha, double P)
Compute the water-filling solution.
int weight(const bvec &a)
Calculate the Hamming weight of a.
bmat graycode(int m)
Generate Gray code of blocklength m.
int hamming_distance(const bvec &a, const bvec &b)
Calculate the Hamming distance between a and b.
Vec< T > reverse(const Vec< T > &in)
Reverse the input vector.
ITPP_EXPORT bvec ones_b(int size)
A Binary vector of ones.
ITPP_EXPORT bvec zeros_b(int size)
A Binary vector of zeros.
Mat< bin > bmat
bin matrix
Various functions on vectors and matrices - header file.
const Array< T > concat(const Array< T > &a, const T &e)
Append element e to the end of the Array a.
bmat to_bmat(const Mat< T > &m)
Converts a Mat<T> to bmat.
Definitions of special vectors and matrices.