Classes | |
| class | Vector |
| class | CanonicalBaseVector |
| class | Matrix |
| class | QuadProg |
Enumerations | |
| enum | MType { DIAG } |
Functions | |
| std::set< unsigned int > | seq (unsigned int s, unsigned int e) |
| std::set< unsigned int > | singleton (unsigned int i) |
| template<typename T > | |
| Vector< T > | operator+ (const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator+ (const Vector< T > &lhs, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator+ (const Vector< T > &lhs, const T &a) |
| template<typename T > | |
| Vector< T > | operator+ (const T &a, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator- (const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator- (const Vector< T > &lhs, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator- (const Vector< T > &lhs, const T &a) |
| template<typename T > | |
| Vector< T > | operator- (const T &a, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator* (const Vector< T > &lhs, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator* (const Vector< T > &lhs, const T &a) |
| template<typename T > | |
| Vector< T > | operator* (const T &a, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator/ (const Vector< T > &lhs, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator/ (const Vector< T > &lhs, const T &a) |
| template<typename T > | |
| Vector< T > | operator/ (const T &a, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator^ (const Vector< T > &lhs, const Vector< T > &rhs) |
| template<typename T > | |
| Vector< T > | operator^ (const Vector< T > &lhs, const T &a) |
| template<typename T > | |
| Vector< T > | operator^ (const T &a, const Vector< T > &rhs) |
| template<typename T > | |
| bool | operator== (const Vector< T > &v, const Vector< T > &w) |
| template<typename T > | |
| bool | operator!= (const Vector< T > &v, const Vector< T > &w) |
| template<typename T > | |
| bool | operator< (const Vector< T > &v, const Vector< T > &w) |
| template<typename T > | |
| bool | operator<= (const Vector< T > &v, const Vector< T > &w) |
| template<typename T > | |
| bool | operator> (const Vector< T > &v, const Vector< T > &w) |
| template<typename T > | |
| bool | operator>= (const Vector< T > &v, const Vector< T > &w) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, const Vector< T > &v) |
| template<typename T > | |
| std::istream & | operator>> (std::istream &is, Vector< T > &v) |
| template<typename T > | |
| T | sum (const Vector< T > &v) |
| template<typename T > | |
| T | prod (const Vector< T > &v) |
| template<typename T > | |
| T | mean (const Vector< T > &v) |
| template<typename T > | |
| T | median (const Vector< T > &v) |
| template<typename T > | |
| T | stdev (const Vector< T > &v, bool sample_correction=false) |
| template<typename T > | |
| T | var (const Vector< T > &v, bool sample_correction=false) |
| template<typename T > | |
| T | max (const Vector< T > &v) |
| template<typename T > | |
| T | min (const Vector< T > &v) |
| template<typename T > | |
| unsigned int | index_max (const Vector< T > &v) |
| template<typename T > | |
| unsigned int | index_min (const Vector< T > &v) |
| template<typename T > | |
| T | dot_prod (const Vector< T > &a, const Vector< T > &b) |
| template<typename T > | |
| Vector< T > | exp (const Vector< T > &v) |
| template<typename T > | |
| Vector< T > | log (const Vector< T > &v) |
| template<typename T > | |
| Vector< T > | sqrt (const Vector< T > &v) |
| template<typename T > | |
| Vector< T > | pow (const Vector< T > &v, double a) |
| template<typename T > | |
| Vector< T > | abs (const Vector< T > &v) |
| template<typename T > | |
| Vector< T > | sign (const Vector< T > &v) |
| template<typename T > | |
| unsigned int | partition (Vector< T > &v, unsigned int begin, unsigned int end) |
| template<typename T > | |
| void | quicksort (Vector< T > &v, unsigned int begin, unsigned int end) |
| template<typename T > | |
| Vector< T > | sort (const Vector< T > &v) |
| template<typename T > | |
| Vector< double > | rank (const Vector< T > &v) |
| template<typename T > | |
| Matrix< T > | operator+ (const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator+ (const Matrix< T > &lhs, const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator+ (const Matrix< T > &lhs, const T &a) |
| template<typename T > | |
| Matrix< T > | operator+ (const T &a, const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator- (const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator- (const Matrix< T > &lhs, const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator- (const Matrix< T > &lhs, const T &a) |
| template<typename T > | |
| Matrix< T > | operator- (const T &a, const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator* (const Matrix< T > &lhs, const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator* (const Matrix< T > &lhs, const T &a) |
| template<typename T > | |
| Matrix< T > | operator* (const T &a, const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator/ (const Matrix< T > &lhs, const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator/ (const Matrix< T > &lhs, const T &a) |
| template<typename T > | |
| Matrix< T > | operator/ (const T &a, const Matrix< T > &rhs) |
| template<typename T > | |
| Matrix< T > | operator^ (const Matrix< T > &lhs, const T &a) |
| template<typename T > | |
| bool | operator== (const Matrix< T > &a, const Matrix< T > &b) |
| template<typename T > | |
| bool | operator!= (const Matrix< T > &a, const Matrix< T > &b) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, const Matrix< T > &m) |
| template<typename T > | |
| std::istream & | operator>> (std::istream &is, Matrix< T > &m) |
| template<typename T > | |
| T | sign (const T &v) |
| template<typename T > | |
| T | dist (const T &a, const T &b) |
| template<typename T > | |
| void | svd (const Matrix< T > &A, Matrix< T > &U, Vector< T > &W, Matrix< T > &V) |
| template<typename T > | |
| Matrix< T > | pinv (const Matrix< T > &A) |
| template<typename T > | |
| int | lu (const Matrix< T > &A, Matrix< T > &LU, Vector< unsigned int > &index) |
| template<typename T > | |
| Vector< T > | lu_solve (const Matrix< T > &LU, const Vector< T > &b, Vector< unsigned int > &index) |
| template<typename T > | |
| void | lu_solve (const Matrix< T > &LU, Vector< T > &x, const Vector< T > &b, Vector< unsigned int > &index) |
| template<typename T > | |
| Matrix< T > | lu_inverse (const Matrix< T > &A) |
| template<typename T > | |
| T | lu_det (const Matrix< T > &A) |
| template<typename T > | |
| void | cholesky (const Matrix< T > A, Matrix< T > &LL) |
| template<typename T > | |
| Matrix< T > | cholesky (const Matrix< T > A) |
| template<typename T > | |
| Vector< T > | cholesky_solve (const Matrix< T > &LL, const Vector< T > &b) |
| template<typename T > | |
| void | cholesky_solve (const Matrix< T > &LL, Vector< T > &x, const Vector< T > &b) |
| template<typename T > | |
| void | forward_elimination (const Matrix< T > &L, Vector< T > &y, const Vector< T > b) |
| template<typename T > | |
| Vector< T > | forward_elimination (const Matrix< T > &L, const Vector< T > b) |
| template<typename T > | |
| void | backward_elimination (const Matrix< T > &U, Vector< T > &x, const Vector< T > &y) |
| template<typename T > | |
| Vector< T > | backward_elimination (const Matrix< T > &U, const Vector< T > y) |
| template<typename T > | |
| void | random (Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | sum (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | r_sum (const Matrix< T > &m) |
| template<typename T > | |
| T | all_sum (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | prod (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | r_prod (const Matrix< T > &m) |
| template<typename T > | |
| T | all_prod (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | mean (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | r_mean (const Matrix< T > &m) |
| template<typename T > | |
| T | all_mean (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | var (const Matrix< T > &m, bool sample_correction=false) |
| template<typename T > | |
| Vector< T > | stdev (const Matrix< T > &m, bool sample_correction=false) |
| template<typename T > | |
| Vector< T > | r_var (const Matrix< T > &m, bool sample_correction=false) |
| template<typename T > | |
| Vector< T > | r_stdev (const Matrix< T > &m, bool sample_correction=false) |
| template<typename T > | |
| Vector< T > | max (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | r_max (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | min (const Matrix< T > &m) |
| template<typename T > | |
| Vector< T > | r_min (const Matrix< T > &m) |
| template<typename T > | |
| Matrix< T > | exp (const Matrix< T > &m) |
| template<typename T > | |
| Matrix< T > | sqrt (const Matrix< T > &m) |
| template<typename T > | |
| Matrix< T > | kron (const Vector< T > &b, const Vector< T > &a) |
| template<typename T > | |
| Matrix< T > | t (const Matrix< T > &a) |
| template<typename T > | |
| Matrix< T > | dot_prod (const Matrix< T > &a, const Matrix< T > &b) |
| template<typename T > | |
| Matrix< T > | dot_prod (const Matrix< T > &a, const Vector< T > &b) |
| template<typename T > | |
| Matrix< T > | dot_prod (const Vector< T > &a, const Matrix< T > &b) |
| template<typename T > | |
| Matrix< double > | rank (const Matrix< T > m) |
| template<typename T > | |
| Matrix< double > | r_rank (const Matrix< T > m) |
| void | compute_d (Vector< double > &d, const Matrix< double > &J, const Vector< double > &np) |
| void | update_z (Vector< double > &z, const Matrix< double > &J, const Vector< double > &d, int iq) |
| void | update_r (const Matrix< double > &R, Vector< double > &r, const Vector< double > &d, int iq) |
| bool | add_constraint (Matrix< double > &R, Matrix< double > &J, Vector< double > &d, int &iq, double &rnorm) |
| void | delete_constraint (Matrix< double > &R, Matrix< double > &J, Vector< int > &A, Vector< double > &u, int n, int p, int &iq, int l) |
| void | cholesky_decomposition (Matrix< double > &A) |
| void | cholesky_solve (const Matrix< double > &L, Vector< double > &x, const Vector< double > &b) |
| void | forward_elimination (const Matrix< double > &L, Vector< double > &y, const Vector< double > &b) |
| void | backward_elimination (const Matrix< double > &U, Vector< double > &x, const Vector< double > &y) |
| double | scalar_product (const Vector< double > &x, const Vector< double > &y) |
| double | distance (double a, double b) |
| void | print_matrix (const char *name, const Matrix< double > &A, int n=-1, int m=-1) |
| template<typename T > | |
| void | print_vector (const char *name, const Vector< T > &v, int n=-1) |
Index utilities
| enum QuadProgPP::MType |
| Vector<T> QuadProgPP::abs | ( | const Vector< T > & | v ) | [inline] |
Definition at line 766 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by itk::OrientationDistributionFunction< TComponent, NOdfDirections >::ComputeBaseMesh(), mitk::PlanarRectangle::EvaluateFeaturesInternal(), vtkThickPlane::EvaluateFunction(), ipMITKSegmentationGetCutPoints(), mitk::PlanarFigureInteractor::IsPositionInsideMarker(), mitk::Image::IsRotated(), mitkPicFileReaderTest(), QmitkDiffusionTensorEstimation::QBallStandardAlgorithmsDeconvolutionButton(), QmitkDiffusionTensorEstimation::QBallStandardAlgorithmsDirectionButton(), and vtkThickPlane::SetThickness().
{
Vector<T> tmp(v.size());
for (unsigned int i = 0; i < v.size(); i++)
tmp[i] = (T)fabs(v[i]);
return tmp;
}
| bool QuadProgPP::add_constraint | ( | Matrix< double > & | R, |
| Matrix< double > & | J, | ||
| Vector< double > & | d, | ||
| int & | iq, | ||
| double & | rnorm | ||
| ) |
Definition at line 532 of file QuadProg.cpp.
References distance(), print_matrix(), print_vector(), and QuadProgPP::Vector< T >::size().
Referenced by QuadProgPP::QuadProg::solve_quadprog().
{
int n = d.size();
#ifdef TRACE_SOLVER
std::cout << "Add constraint " << iq << '/';
#endif
register int i, j, k;
double cc, ss, h, t1, t2, xny;
/* we have to find the Givens rotation which will reduce the element
d[j] to zero.
if it is already zero we don't have to do anything, except of
decreasing j */
for (j = n - 1; j >= iq + 1; j--)
{
/* The Givens rotation is done with the matrix (cc cs, cs -cc).
If cc is one, then element (j) of d is zero compared with element
(j - 1). Hence we don't have to do anything.
If cc is zero, then we just have to switch column (j) and column (j - 1)
of J. Since we only switch columns in J, we have to be careful how we
update d depending on the sign of gs.
Otherwise we have to apply the Givens rotation to these columns.
The i - 1 element of d has to be updated to h. */
cc = d[j - 1];
ss = d[j];
h = distance(cc, ss);
if (fabs(h) < std::numeric_limits<double>::epsilon()) // h == 0
continue;
d[j] = 0.0;
ss = ss / h;
cc = cc / h;
if (cc < 0.0)
{
cc = -cc;
ss = -ss;
d[j - 1] = -h;
}
else
d[j - 1] = h;
xny = ss / (1.0 + cc);
for (k = 0; k < n; k++)
{
t1 = J[k][j - 1];
t2 = J[k][j];
J[k][j - 1] = t1 * cc + t2 * ss;
J[k][j] = xny * (t1 + J[k][j - 1]) - t2;
}
}
/* update the number of constraints added*/
iq++;
/* To update R we have to put the iq components of the d vector
into column iq - 1 of R
*/
for (i = 0; i < iq; i++)
R[i][iq - 1] = d[i];
#ifdef TRACE_SOLVER
std::cout << iq << std::endl;
print_matrix("R", R, iq, iq);
print_matrix("J", J);
print_vector("d", d, iq);
#endif
if (fabs(d[iq - 1]) <= std::numeric_limits<double>::epsilon() * R_norm)
{
// problem degenerate
return false;
}
R_norm = std::max<double>(R_norm, fabs(d[iq - 1]));
return true;
}
| T QuadProgPP::all_mean | ( | const Matrix< T > & | m ) |
Definition at line 2297 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
T tmp = (T)0;
for (unsigned int i = 0; i < m.nrows(); i++)
for (unsigned int j = 0; j < m.ncols(); j++)
tmp += m[i][j];
return tmp / (m.nrows() * m.ncols());
}
| T QuadProgPP::all_prod | ( | const Matrix< T > & | m ) |
Definition at line 2259 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
T tmp = (T)1;
for (unsigned int i = 0; i < m.nrows(); i++)
for (unsigned int j = 0; j < m.ncols(); j++)
tmp *= m[i][j];
return tmp;
}
| T QuadProgPP::all_sum | ( | const Matrix< T > & | m ) |
Definition at line 2229 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
T tmp = (T)0;
for (unsigned int i = 0; i < m.nrows(); i++)
for (unsigned int j = 0; j < m.ncols(); j++)
tmp += m[i][j];
return tmp;
}
| Vector<T> QuadProgPP::backward_elimination | ( | const Matrix< T > & | U, |
| const Vector< T > | y | ||
| ) |
Definition at line 2180 of file Array.h.
References forward_elimination().
{
Vector<T> x;
forward_elimination(U, x, y);
return x;
}
| void QuadProgPP::backward_elimination | ( | const Matrix< T > & | U, |
| Vector< T > & | x, | ||
| const Vector< T > & | y | ||
| ) |
Definition at line 2160 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), QuadProgPP::Vector< T >::resize(), and QuadProgPP::Vector< T >::size().
Referenced by cholesky_solve().
{
if (U.ncols() != U.nrows())
throw std::logic_error("Error in Backward elimination: matrix must be squared (upper triangular)");
if (y.size() != U.nrows())
throw std::logic_error("Error in Backward elimination: b vector must be of the same dimensions of U matrix");
int i, j, n = y.size();
x.resize(n);
x[n - 1] = y[n - 1] / U[n - 1][n - 1];
for (i = n - 2; i >= 0; i--)
{
x[i] = y[i];
for (j = i + 1; j < n; j++)
x[i] -= U[i][j] * x[j];
x[i] = x[i] / U[i][i];
}
}
| void QuadProgPP::backward_elimination | ( | const Matrix< double > & | U, |
| Vector< double > & | x, | ||
| const Vector< double > & | y | ||
| ) | [inline] |
| Matrix<T> QuadProgPP::cholesky | ( | const Matrix< T > | A ) |
Definition at line 2098 of file Array.h.
References cholesky().
{
Matrix<T> LL;
cholesky(A, LL);
return LL;
}
| void QuadProgPP::cholesky | ( | const Matrix< T > | A, |
| Matrix< T > & | LL | ||
| ) |
Definition at line 2068 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), sqrt(), and sum().
Referenced by cholesky().
{
if (A.ncols() != A.nrows())
throw std::logic_error("Error in Cholesky decomposition: matrix must be squared");
int i, j, k, n = A.ncols();
double sum;
LL = A;
for (i = 0; i < n; i++)
{
for (j = i; j < n; j++)
{
sum = LL[i][j];
for (k = i - 1; k >= 0; k--)
sum -= LL[i][k] * LL[j][k];
if (i == j)
{
if (sum <= 0.0)
throw std::logic_error("Error in Cholesky decomposition: matrix is not postive definite");
LL[i][i] = ::std::sqrt(sum);
}
else
LL[j][i] = sum / LL[i][i];
}
for (k = i + 1; k < n; k++)
LL[i][k] = LL[k][i];
}
}
| void QuadProgPP::cholesky_decomposition | ( | Matrix< double > & | A ) |
Definition at line 711 of file QuadProg.cpp.
References QuadProgPP::Matrix< T >::nrows(), print_matrix(), sqrt(), and sum().
Referenced by QuadProgPP::QuadProg::solve_quadprog().
{
register int i, j, k, n = A.nrows();
register double sum;
for (i = 0; i < n; i++)
{
for (j = i; j < n; j++)
{
sum = A[i][j];
for (k = i - 1; k >= 0; k--)
sum -= A[i][k]*A[j][k];
if (i == j)
{
if (sum <= 0.0)
{
std::ostringstream os;
// raise error
print_matrix("A", A);
os << "Error in cholesky decomposition, sum: " << sum;
throw std::logic_error(os.str());
exit(-1);
}
A[i][i] = ::std::sqrt(sum);
}
else
A[j][i] = sum / A[i][i];
}
for (k = i + 1; k < n; k++)
A[i][k] = A[k][i];
}
}
| Vector<T> QuadProgPP::cholesky_solve | ( | const Matrix< T > & | LL, |
| const Vector< T > & | b | ||
| ) |
Definition at line 2107 of file Array.h.
References backward_elimination(), forward_elimination(), QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and QuadProgPP::Vector< T >::size().
Referenced by cholesky_solve(), and QuadProgPP::QuadProg::solve_quadprog().
{
if (LL.ncols() != LL.nrows())
throw std::logic_error("Error in Cholesky solve: matrix must be squared");
unsigned int n = LL.ncols();
if (b.size() != n)
throw std::logic_error("Error in Cholesky decomposition: b vector must be of the same dimensions of LU matrix");
Vector<T> x, y;
/* Solve L * y = b */
forward_elimination(LL, y, b);
/* Solve L^T * x = y */
backward_elimination(LL, x, y);
return x;
}
| void QuadProgPP::cholesky_solve | ( | const Matrix< T > & | LL, |
| Vector< T > & | x, | ||
| const Vector< T > & | b | ||
| ) |
Definition at line 2125 of file Array.h.
References cholesky_solve().
{
x = cholesky_solve(LL, b);
}
| void QuadProgPP::cholesky_solve | ( | const Matrix< double > & | L, |
| Vector< double > & | x, | ||
| const Vector< double > & | b | ||
| ) |
Definition at line 744 of file QuadProg.cpp.
References backward_elimination(), forward_elimination(), and QuadProgPP::Matrix< T >::nrows().
{
int n = L.nrows();
Vector<double> y(n);
/* Solve L * y = b */
forward_elimination(L, y, b);
/* Solve L^T * x = y */
backward_elimination(L, x, y);
}
| void QuadProgPP::compute_d | ( | Vector< double > & | d, |
| const Matrix< double > & | J, | ||
| const Vector< double > & | np | ||
| ) | [inline] |
Definition at line 489 of file QuadProg.cpp.
References QuadProgPP::Vector< T >::size(), and sum().
Referenced by QuadProgPP::QuadProg::solve_quadprog().
| void QuadProgPP::delete_constraint | ( | Matrix< double > & | R, |
| Matrix< double > & | J, | ||
| Vector< int > & | A, | ||
| Vector< double > & | u, | ||
| int | n, | ||
| int | p, | ||
| int & | iq, | ||
| int | l | ||
| ) |
Definition at line 603 of file QuadProg.cpp.
References distance().
Referenced by QuadProgPP::QuadProg::solve_quadprog().
{
#ifdef TRACE_SOLVER
std::cout << "Delete constraint " << l << ' ' << iq;
#endif
register int i, j, k, qq = -1; // just to prevent warnings from smart compilers
double cc, ss, h, xny, t1, t2;
/* Find the index qq for active constraint l to be removed */
for (i = p; i < iq; i++)
if (A[i] == l)
{
qq = i;
break;
}
/* remove the constraint from the active set and the duals */
for (i = qq; i < iq - 1; i++)
{
A[i] = A[i + 1];
u[i] = u[i + 1];
for (j = 0; j < n; j++)
R[j][i] = R[j][i + 1];
}
A[iq - 1] = A[iq];
u[iq - 1] = u[iq];
A[iq] = 0;
u[iq] = 0.0;
for (j = 0; j < iq; j++)
R[j][iq - 1] = 0.0;
/* constraint has been fully removed */
iq--;
#ifdef TRACE_SOLVER
std::cout << '/' << iq << std::endl;
#endif
if (iq == 0)
return;
for (j = qq; j < iq; j++)
{
cc = R[j][j];
ss = R[j + 1][j];
h = distance(cc, ss);
if (fabs(h) < std::numeric_limits<double>::epsilon()) // h == 0
continue;
cc = cc / h;
ss = ss / h;
R[j + 1][j] = 0.0;
if (cc < 0.0)
{
R[j][j] = -h;
cc = -cc;
ss = -ss;
}
else
R[j][j] = h;
xny = ss / (1.0 + cc);
for (k = j + 1; k < iq; k++)
{
t1 = R[j][k];
t2 = R[j + 1][k];
R[j][k] = t1 * cc + t2 * ss;
R[j + 1][k] = xny * (t1 + R[j][k]) - t2;
}
for (k = 0; k < n; k++)
{
t1 = J[k][j];
t2 = J[k][j + 1];
J[k][j] = t1 * cc + t2 * ss;
J[k][j + 1] = xny * (J[k][j] + t1) - t2;
}
}
}
| T QuadProgPP::dist | ( | const T & | a, |
| const T & | b | ||
| ) |
Definition at line 1664 of file Array.h.
References sqrt().
Referenced by mitk::OdfVtkMapper2D< TPixelType, NrOdfDirections >::AdaptCameraPosition(), ANNkd_leaf::ann_FR_search(), ANNbd_shrink::ann_FR_search(), ANNkd_leaf::ann_pri_search(), ANNbd_shrink::ann_pri_search(), ANNkd_leaf::ann_search(), ANNbd_shrink::ann_search(), annBoxDistance(), annDist(), mitk::ExtrudedContour::BuildGeometry(), QmitkPointBasedRegistrationView::checkLandmarkError(), QwtPlotRescaler::expandScale(), QwtRoundScaleDraw::extent(), mitk::NavigationDataLandmarkTransformFilter::FindCorrespondentLandmarks(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetInterpolatedComponent(), mitk::SeedsImage::GetNit(), ipMITKSegmentationGetCutPoints(), mitk::ExtrudedContour::IsInside(), QwtScaleDraw::labelPosition(), QwtScaleDraw::minLabelDist(), mitkPicFileReaderTest(), mitk::PointSet::SearchPoint(), svd(), and QwtPlotRescaler::syncScale().
| double QuadProgPP::distance | ( | double | a, |
| double | b | ||
| ) | [inline] |
Definition at line 680 of file QuadProg.cpp.
Referenced by add_constraint(), mitk::PointSelectorInteractor::CanHandleEvent(), mitk::PointInteractor::CanHandleEvent(), mitk::ConnectPointsInteractor::CanHandleEvent(), QmitkMeasurement::CopyToClipboard(), delete_constraint(), mitk::DisplayInteractor::ExecuteOperation(), QmitkDataStorageComboBox::Find(), QmitkPropertiesTableModel::FindProperty(), QmitkDataStorageTreeModel::TreeItem::IndexOfChild(), QmitkDataStorageListModel::OnModified(), mitk::PointSetGLMapper2D::Paint(), mitk::SurfaceGLMapper2D::PaintCells(), QmitkDataStorageTableModel::PropertyModified(), QmitkDataStorageTableModel::RemoveNode(), mitk::Mesh::SearchLine(), mitk::PointSet::SearchPoint(), QwtPlotScaleItem::setBorderDistance(), QmitkToolDistanceWidget::ShowDistanceValues(), and QmitkVtkLineProfileWidget::UpdateItemModelFromPath().
{
register double a1, b1, t;
a1 = fabs(a);
b1 = fabs(b);
if (a1 > b1)
{
t = (b1 / a1);
return a1 * ::std::sqrt(1.0 + t * t);
}
else
if (b1 > a1)
{
t = (a1 / b1);
return b1 * ::std::sqrt(1.0 + t * t);
}
return a1 * ::std::sqrt(2.0);
}
| T QuadProgPP::dot_prod | ( | const Vector< T > & | a, |
| const Vector< T > & | b | ||
| ) | [inline] |
Definition at line 710 of file Array.h.
References QuadProgPP::Vector< T >::size(), and sum().
Referenced by pinv().
| Matrix<T> QuadProgPP::dot_prod | ( | const Matrix< T > & | a, |
| const Vector< T > & | b | ||
| ) |
Definition at line 2502 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and QuadProgPP::Vector< T >::size().
{
if (a.ncols() != b.size())
throw std::logic_error("Error matrix dot product: dimensions of the matrix and the vector are not compatible");
Matrix<T> tmp(a.nrows(), 1);
for (unsigned int i = 0; i < tmp.nrows(); i++)
{
tmp[i][0] = (T)0;
for (unsigned int k = 0; k < a.ncols(); k++)
tmp[i][0] += a[i][k] * b[k];
}
return tmp;
}
| Matrix<T> QuadProgPP::dot_prod | ( | const Vector< T > & | a, |
| const Matrix< T > & | b | ||
| ) |
Definition at line 2518 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Vector< T >::size().
{
if (a.size() != b.ncols())
throw std::logic_error("Error matrix dot product: dimensions of the vector and matrix are not compatible");
Matrix<T> tmp(1, b.ncols());
for (unsigned int j = 0; j < tmp.ncols(); j++)
{
tmp[0][j] = (T)0;
for (unsigned int k = 0; k < a.size(); k++)
tmp[0][j] += a[k] * b[k][j];
}
return tmp;
}
| Matrix<T> QuadProgPP::dot_prod | ( | const Matrix< T > & | a, |
| const Matrix< T > & | b | ||
| ) |
Definition at line 2485 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
if (a.ncols() != b.nrows())
throw std::logic_error("Error matrix dot product: dimensions of the matrices are not compatible");
Matrix<T> tmp(a.nrows(), b.ncols());
for (unsigned int i = 0; i < tmp.nrows(); i++)
for (unsigned int j = 0; j < tmp.ncols(); j++)
{
tmp[i][j] = (T)0;
for (unsigned int k = 0; k < a.ncols(); k++)
tmp[i][j] += a[i][k] * b[k][j];
}
return tmp;
}
| Vector<T> QuadProgPP::exp | ( | const Vector< T > & | v ) | [inline] |
Single element mathematical functions
Definition at line 726 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by mitk::SurfaceDeformationInteractor3D::ColorizeSurface(), itk::DiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NrOdfDirections, NrBasisFunctionCenters >::ComputeReconstructionMatrix(), mitk::SurfaceDeformationInteractor3D::ExecuteAction(), exp(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetInterpolatedComponent(), QwtScaleTransformation::invXForm(), QmitkIGTExampleView::OnStop(), QmitkIGTExampleView::OnTestNavigation(), itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::ThreadedGenerateData(), and QwtAbstractSlider::timerEvent().
{
Vector<T> tmp(v.size());
for (unsigned int i = 0; i < v.size(); i++)
tmp[i] = exp(v[i]);
return tmp;
}
| Matrix<T> QuadProgPP::exp | ( | const Matrix< T > & | m ) |
Single element mathematical functions
Definition at line 2435 of file Array.h.
References exp(), QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(m.nrows(), m.ncols());
for (unsigned int i = 0; i < m.nrows(); i++)
for (unsigned int j = 0; j < m.ncols(); j++)
tmp[i][j] = exp(m[i][j]);
return tmp;
}
| void QuadProgPP::forward_elimination | ( | const Matrix< double > & | L, |
| Vector< double > & | y, | ||
| const Vector< double > & | b | ||
| ) | [inline] |
Definition at line 755 of file QuadProg.cpp.
References QuadProgPP::Matrix< T >::nrows().
| void QuadProgPP::forward_elimination | ( | const Matrix< T > & | L, |
| Vector< T > & | y, | ||
| const Vector< T > | b | ||
| ) |
Definition at line 2131 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), QuadProgPP::Vector< T >::resize(), and QuadProgPP::Vector< T >::size().
Referenced by backward_elimination(), cholesky_solve(), forward_elimination(), and QuadProgPP::QuadProg::solve_quadprog().
{
if (L.ncols() != L.nrows())
throw std::logic_error("Error in Forward elimination: matrix must be squared (lower triangular)");
if (b.size() != L.nrows())
throw std::logic_error("Error in Forward elimination: b vector must be of the same dimensions of L matrix");
int i, j, n = b.size();
y.resize(n);
y[0] = b[0] / L[0][0];
for (i = 1; i < n; i++)
{
y[i] = b[i];
for (j = 0; j < i; j++)
y[i] -= L[i][j] * y[j];
y[i] = y[i] / L[i][i];
}
}
| Vector<T> QuadProgPP::forward_elimination | ( | const Matrix< T > & | L, |
| const Vector< T > | b | ||
| ) |
Definition at line 2151 of file Array.h.
References forward_elimination().
{
Vector<T> y;
forward_elimination(L, y, b);
return y;
}
| unsigned int QuadProgPP::index_max | ( | const Vector< T > & | v ) | [inline] |
| unsigned int QuadProgPP::index_min | ( | const Vector< T > & | v ) | [inline] |
| Matrix<T> QuadProgPP::kron | ( | const Vector< T > & | b, |
| const Vector< T > & | a | ||
| ) |
Matrix operators
Definition at line 2463 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Matrix<T> tmp(b.size(), a.size());
for (unsigned int i = 0; i < b.size(); i++)
for (unsigned int j = 0; j < a.size(); j++)
tmp[i][j] = a[j] * b[i];
return tmp;
}
| Vector<T> QuadProgPP::log | ( | const Vector< T > & | v ) | [inline] |
Definition at line 736 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by mitk::SimpleHistogram::ComputeFromImage(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetNormalizedEntropy(), mitk::SimpleHistogram::GetRelativeBin(), QwtScaleTransformation::invXForm(), itk::DiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NrOdfDirections, NrBasisFunctionCenters >::Normalize(), itk::AnalyticalDiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NOrderL, NrOdfDirections >::Normalize(), itk::DiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NrOdfDirections, NrBasisFunctionCenters >::PreNormalize(), itk::AnalyticalDiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NOrderL, NrOdfDirections >::PreNormalize(), QwtScaleTransformation::xForm(), and QwtScaleMap::xTransform().
{
Vector<T> tmp(v.size());
for (unsigned int i = 0; i < v.size(); i++)
tmp[i] = log(v[i]);
return tmp;
}
| int QuadProgPP::lu | ( | const Matrix< T > & | A, |
| Matrix< T > & | LU, | ||
| Vector< unsigned int > & | index | ||
| ) |
Definition at line 1934 of file Array.h.
References max(), QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and QuadProgPP::Vector< T >::resize().
Referenced by lu_det(), and lu_inverse().
{
if (A.ncols() != A.nrows())
throw std::logic_error("Error in LU decomposition: matrix must be squared");
int i, p, j, k, n = A.ncols(), ex;
T val, tmp;
Vector<T> d(n);
LU = A;
index.resize(n);
ex = 1;
for (i = 0; i < n; i++)
{
index[i] = i;
val = (T)0.0;
for (j = 0; j < n; j++)
val = std::max(val, (T)fabs(LU[i][j]));
if (val == (T)0.0)
std::logic_error("Error in LU decomposition: matrix was singular");
d[i] = val;
}
for (k = 0; k < n - 1; k++)
{
p = k;
val = fabs(LU[k][k]) / d[k];
for (i = k + 1; i < n; i++)
{
tmp = fabs(LU[i][k]) / d[i];
if (tmp > val)
{
val = tmp;
p = i;
}
}
if (val == (T)0.0)
std::logic_error("Error in LU decomposition: matrix was singular");
if (p > k)
{
ex = -ex;
std::swap(index[k], index[p]);
std::swap(d[k], d[p]);
for (j = 0; j < n; j++)
std::swap(LU[k][j], LU[p][j]);
}
for (i = k + 1; i < n; i++)
{
LU[i][k] /= LU[k][k];
for (j = k + 1; j < n; j++)
LU[i][j] -= LU[i][k] * LU[k][j];
}
}
if (LU[n - 1][n - 1] == (T)0.0)
std::logic_error("Error in LU decomposition: matrix was singular");
return ex;
}
| T QuadProgPP::lu_det | ( | const Matrix< T > & | A ) |
Definition at line 2054 of file Array.h.
References QuadProgPP::Matrix< T >::extractDiag(), lu(), QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and prod().
| Matrix<T> QuadProgPP::lu_inverse | ( | const Matrix< T > & | A ) |
Definition at line 2034 of file Array.h.
References lu(), lu_solve(), QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and QuadProgPP::CanonicalBaseVector< T >::reset().
{
if (A.ncols() != A.nrows())
throw std::logic_error("Error in LU invert: matrix must be squared");
unsigned int n = A.ncols();
Matrix<T> A1(n, n), LU;
Vector<unsigned int> index;
lu(A, LU, index);
CanonicalBaseVector<T> e(0, n);
for (unsigned i = 0; i < n; i++)
{
e.reset(i);
A1.setColumn(i, lu_solve(LU, e, index));
}
return A1;
}
| Vector<T> QuadProgPP::lu_solve | ( | const Matrix< T > & | LU, |
| const Vector< T > & | b, | ||
| Vector< unsigned int > & | index | ||
| ) |
Definition at line 1994 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), QuadProgPP::Vector< T >::size(), and sum().
Referenced by lu_inverse(), and lu_solve().
{
if (LU.ncols() != LU.nrows())
throw std::logic_error("Error in LU solve: LU matrix should be squared");
unsigned int n = LU.ncols();
if (b.size() != n)
throw std::logic_error("Error in LU solve: b vector must be of the same dimensions of LU matrix");
Vector<T> x((T)0.0, n);
int i, j, p;
T sum;
p = index[0];
x[0] = b[p];
for (i = 1; i < n; i++)
{
sum = (T)0.0;
for (j = 0; j < i; j++)
sum += LU[i][j] * x[j];
p = index[i];
x[i] = b[p] - sum;
}
x[n - 1] /= LU[n - 1][n - 1];
for (i = n - 2; i >= 0; i--)
{
sum = (T)0.0;
for (j = i + 1; j < n; j++)
sum += LU[i][j] * x[j];
x[i] = (x[i] - sum) / LU[i][i];
}
return x;
}
| void QuadProgPP::lu_solve | ( | const Matrix< T > & | LU, |
| Vector< T > & | x, | ||
| const Vector< T > & | b, | ||
| Vector< unsigned int > & | index | ||
| ) |
| T QuadProgPP::max | ( | const Vector< T > & | v ) | [inline] |
Definition at line 667 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by QmitkRenderWindow::AdjustRenderWindowMenuVisibility(), ANNmin_k::ANNmin_k(), ANNpr_queue::ANNpr_queue(), annSpread(), mitk::ExtrudedContour::BuildGeometry(), mitk::PolygonToRingFilter::BuildVtkTube(), mitk::CalculateGrayValueStatisticsTool::CalculateMinMax(), mitk::Interactor::CanHandleEvent(), mitk::PlanarPolygon::CheckForLineIntersection(), mitk::DataStorage::ComputeBoundingGeometry3D(), itk::BrainMaskExtractionImageFilter< TOutputImagePixelType >::ComputeHistogram(), mitk::Image::ComputeImageStatistics(), itk::DiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NrOdfDirections, NrBasisFunctionCenters >::ComputeReconstructionMatrix(), mitk::DataStorage::ComputeTimeBounds(), QwtScaleDiv::contains(), QmitkPropertyDelegate::createEditor(), mitk::Image::Expand(), mitk::TimeSlicedGeometry::ExpandToNumberOfTimeSteps(), mitk::NavigationDataLandmarkTransformFilter::FindCorrespondentLandmarks(), mitk::BoundingObjectToSegmentationFilter::GenerateData(), mitk::CylindricToCartesianFilter::GenerateOutputInformation(), GenerateRandomNumber(), GenerateRandomPoint(), mitk::PropertyManager::GetDefaultLimits(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetGeneralizedGFA(), mitk::TimeSlicedGeometry::GetGeometry3D(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetInterpolatedComponent(), mitk::LabeledImageToSurfaceFilter::GetLabelForNthOutput(), mitk::SimpleHistogram::GetMax(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetNthDiffusionDirection(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetPrincipleCurvature(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetPrincipleDiffusionDirection(), mitk::Image::GetScalarValue2ndMinNoRecompute(), mitk::Image::GetScalarValueMinNoRecompute(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetStdDevByMaxValue(), mitk::Image::Image(), index_max(), mitk::Geometry3D::Initialize(), mitk::RenderingManager::InitializeViews(), QmitkSliceWidget::InitWidget(), mitk::MaskImageFilter::InternalComputeMask(), mitk::CalculateGrayValueStatisticsTool::ITKHistogramming(), QmitkRegionGrowingView::ItkImageProcessing(), lu(), max(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::MaxNormalize(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::MinMaxNormalize(), mitkPicFileReaderTest(), mitk::TimeSlicedGeometry::MSToTimeStep(), mitk::MeshMapper2D::Paint(), QxtItemDelegatePrivate::paintProgress(), mitk::SphereLandmarkProjector::ProjectLandmarks(), QmitkDiffusionTensorEstimation::QBallStandardAlgorithmsDeconvolutionButton(), QmitkDiffusionTensorEstimation::QBallStandardAlgorithmsDirectionButton(), r_max(), mitk::Image::ResetImageStatistics(), mitk::LevelWindow::SetAuto(), QwtPlot::setAxisScale(), QmitkSliderNavigatorWidget::SetLabelValues(), QmitkTransferFunctionCanvas::SetMax(), mitk::Stepper::SetRange(), mitk::RenderingManager::SetShading(), mitk::ManufacturerLogo::SetupCamera(), mitk::ManufacturerLogo::SetupPosition(), sl_fair_split(), sl_midpt_split(), QuadProgPP::QuadProg::solve_quadprog(), QmitkBasicImageProcessing::StartButtonClicked(), QmitkImageCropper::SurroundingCheck(), svd(), mitkClaronTrackingDeviceTestClass::TestToolConfiguration(), mitk::TimeSlicedGeometry::TimeStepToMS(), QxtSpanSliderPrivate::triggerAction(), QxtFlowViewAnimator::update(), mitk::TimeSlicedGeometry::UpdateInformation(), and QxtBaseSpinBox::validate().
{
T value = v[0];
for (unsigned int i = 1; i < v.size(); i++)
value = std::max(v[i], value);
return value;
}
| Vector<T> QuadProgPP::max | ( | const Matrix< T > & | m ) |
Definition at line 2365 of file Array.h.
References max(), QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> res(m.ncols());
double value;
for (unsigned int j = 0; j < m.ncols(); j++)
{
value = m[0][j];
for (unsigned int i = 1; i < m.nrows(); i++)
value = std::max(m[i][j], value);
res[j] = value;
}
return res;
}
| T QuadProgPP::mean | ( | const Vector< T > & | v ) | [inline] |
Definition at line 626 of file Array.h.
References QuadProgPP::Vector< T >::size(), and sum().
Referenced by itk::BrainMaskExtractionImageFilter< TOutputImagePixelType >::ComputeHistogram(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetGeneralizedFractionalAnisotropy(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetGeneralizedGFA(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetNormalizedEntropy(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetStdDevByMaxValue(), and mitk::CalculateGrayValueStatisticsTool::ITKHistogramming().
{
T sum = (T)0;
for (unsigned int i = 0; i < v.size(); i++)
sum += v[i];
return sum / v.size();
}
| Vector<T> QuadProgPP::mean | ( | const Matrix< T > & | m ) |
Definition at line 2269 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> res((T)0, m.ncols());
for (unsigned int j = 0; j < m.ncols(); j++)
{
for (unsigned int i = 0; i < m.nrows(); i++)
res[j] += m[i][j];
res[j] /= m.nrows();
}
return res;
}
| T QuadProgPP::median | ( | const Vector< T > & | v ) | [inline] |
Definition at line 635 of file Array.h.
References QuadProgPP::Vector< T >::size(), and sort().
Referenced by mitk::ManualSegmentationToSurfaceFilter::GenerateData(), and itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetPrincipleCurvature().
{
Vector<T> tmp = sort(v);
if (v.size() % 2 == 1) // it is an odd-sized vector
return tmp[v.size() / 2];
else
return 0.5 * (tmp[v.size() / 2 - 1] + tmp[v.size() / 2]);
}
| T QuadProgPP::min | ( | const Vector< T > & | v ) | [inline] |
Definition at line 677 of file Array.h.
References min, and QuadProgPP::Vector< T >::size().
Referenced by QuadProgPP::Matrix< T >::extractDiag(), index_min(), and QuadProgPP::QuadProg::solve_quadprog().
{
T value = v[0];
for (unsigned int i = 1; i < v.size(); i++)
value = std::min(v[i], value);
return value;
}
| Vector<T> QuadProgPP::min | ( | const Matrix< T > & | m ) |
Definition at line 2397 of file Array.h.
References min, QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> res(m.ncols());
double value;
for (unsigned int j = 0; j < m.ncols(); j++)
{
value = m[0][j];
for (unsigned int i = 1; i < m.nrows(); i++)
value = std::min(m[i][j], value);
res[j] = value;
}
return res;
}
| bool QuadProgPP::operator!= | ( | const Matrix< T > & | a, |
| const Matrix< T > & | b | ||
| ) | [inline] |
Definition at line 1610 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
if (a.nrows() != b.nrows() || a.ncols() != b.ncols())
throw std::logic_error("Matrices of different size are not confrontable");
for (unsigned i = 0; i < a.nrows(); i++)
for (unsigned j = 0; j < a.ncols(); j++)
if (a[i][j] != b[i][j])
return true;
return false;
}
| bool QuadProgPP::operator!= | ( | const Vector< T > & | v, |
| const Vector< T > & | w | ||
| ) | [inline] |
Definition at line 491 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
if (v.size() != w.size())
throw std::logic_error("Vectors of different size are not confrontable");
for (unsigned i = 0; i < v.size(); i++)
if (v[i] != w[i])
return true;
return false;
}
| Vector<T> QuadProgPP::operator* | ( | const Vector< T > & | lhs, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 343 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
if (lhs.size() != rhs.size())
throw std::logic_error("Operator*: vectors have different sizes");
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = lhs[i] * rhs[i];
return tmp;
}
| Matrix<T> QuadProgPP::operator* | ( | const Matrix< T > & | lhs, |
| const T & | a | ||
| ) |
Definition at line 1452 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] * a;
return tmp;
}
| Vector<T> QuadProgPP::operator* | ( | const T & | a, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 365 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(rhs.size());
for (unsigned int i = 0; i < rhs.size(); i++)
tmp[i] = a * rhs[i];
return tmp;
}
| Matrix<T> QuadProgPP::operator* | ( | const Matrix< T > & | lhs, |
| const Matrix< T > & | rhs | ||
| ) |
Definition at line 1439 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
if (lhs.ncols() != rhs.ncols() || lhs.nrows() != rhs.nrows())
throw std::logic_error("Operator*: matrices have different sizes");
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] * rhs[i][j];
return tmp;
}
| Matrix<T> QuadProgPP::operator* | ( | const T & | a, |
| const Matrix< T > & | rhs | ||
| ) |
Definition at line 1463 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(rhs.nrows(), rhs.ncols());
for (unsigned int i = 0; i < rhs.nrows(); i++)
for (unsigned int j = 0; j < rhs.ncols(); j++)
tmp[i][j] = a * rhs[i][j];
return tmp;
}
| Vector<T> QuadProgPP::operator* | ( | const Vector< T > & | lhs, |
| const T & | a | ||
| ) | [inline] |
Definition at line 355 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = lhs[i] * a;
return tmp;
}
| Matrix<T> QuadProgPP::operator+ | ( | const Matrix< T > & | lhs, |
| const T & | a | ||
| ) |
Definition at line 1332 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] + a;
return tmp;
}
| Vector<T> QuadProgPP::operator+ | ( | const Vector< T > & | lhs, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 231 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
if (lhs.size() != rhs.size())
throw std::logic_error("Operator+: vectors have different sizes");
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = lhs[i] + rhs[i];
return tmp;
}
| Vector<T> QuadProgPP::operator+ | ( | const Vector< T > & | rhs ) | [inline] |
| Vector<T> QuadProgPP::operator+ | ( | const Vector< T > & | lhs, |
| const T & | a | ||
| ) | [inline] |
Definition at line 243 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = lhs[i] + a;
return tmp;
}
| Matrix<T> QuadProgPP::operator+ | ( | const Matrix< T > & | rhs ) |
| Matrix<T> QuadProgPP::operator+ | ( | const Matrix< T > & | lhs, |
| const Matrix< T > & | rhs | ||
| ) |
Definition at line 1319 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
if (lhs.ncols() != rhs.ncols() || lhs.nrows() != rhs.nrows())
throw std::logic_error("Operator+: matrices have different sizes");
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] + rhs[i][j];
return tmp;
}
| Matrix<T> QuadProgPP::operator+ | ( | const T & | a, |
| const Matrix< T > & | rhs | ||
| ) |
Definition at line 1343 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(rhs.nrows(), rhs.ncols());
for (unsigned int i = 0; i < rhs.nrows(); i++)
for (unsigned int j = 0; j < rhs.ncols(); j++)
tmp[i][j] = a + rhs[i][j];
return tmp;
}
| Vector<T> QuadProgPP::operator+ | ( | const T & | a, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 253 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(rhs.size());
for (unsigned int i = 0; i < rhs.size(); i++)
tmp[i] = a + rhs[i];
return tmp;
}
| Vector<T> QuadProgPP::operator- | ( | const Vector< T > & | lhs, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 290 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
if (lhs.size() != rhs.size())
throw std::logic_error("Operator-: vectors have different sizes");
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = lhs[i] - rhs[i];
return tmp;
}
| Vector<T> QuadProgPP::operator- | ( | const Vector< T > & | lhs, |
| const T & | a | ||
| ) | [inline] |
Definition at line 302 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = lhs[i] - a;
return tmp;
}
| Matrix<T> QuadProgPP::operator- | ( | const Matrix< T > & | lhs, |
| const Matrix< T > & | rhs | ||
| ) |
Definition at line 1382 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
if (lhs.ncols() != rhs.ncols() || lhs.nrows() != rhs.nrows())
throw std::logic_error("Operator-: matrices have different sizes");
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] - rhs[i][j];
return tmp;
}
| Matrix<T> QuadProgPP::operator- | ( | const Matrix< T > & | rhs ) |
| Vector<T> QuadProgPP::operator- | ( | const T & | a, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 312 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(rhs.size());
for (unsigned int i = 0; i < rhs.size(); i++)
tmp[i] = a - rhs[i];
return tmp;
}
| Matrix<T> QuadProgPP::operator- | ( | const Matrix< T > & | lhs, |
| const T & | a | ||
| ) |
Definition at line 1395 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] - a;
return tmp;
}
| Matrix<T> QuadProgPP::operator- | ( | const T & | a, |
| const Matrix< T > & | rhs | ||
| ) |
Definition at line 1406 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(rhs.nrows(), rhs.ncols());
for (unsigned int i = 0; i < rhs.nrows(); i++)
for (unsigned int j = 0; j < rhs.ncols(); j++)
tmp[i][j] = a - rhs[i][j];
return tmp;
}
| Vector<T> QuadProgPP::operator- | ( | const Vector< T > & | rhs ) | [inline] |
| Vector<T> QuadProgPP::operator/ | ( | const T & | a, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 418 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(rhs.size());
for (unsigned int i = 0; i < rhs.size(); i++)
tmp[i] = a / rhs[i];
return tmp;
}
| Matrix<T> QuadProgPP::operator/ | ( | const Matrix< T > & | lhs, |
| const Matrix< T > & | rhs | ||
| ) |
Definition at line 1496 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
if (lhs.ncols() != rhs.ncols() || lhs.nrows() != rhs.nrows())
throw std::logic_error("Operator+: matrices have different sizes");
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] / rhs[i][j];
return tmp;
}
| Vector<T> QuadProgPP::operator/ | ( | const Vector< T > & | lhs, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 396 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
if (lhs.size() != rhs.size())
throw std::logic_error("Operator/: vectors have different sizes");
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = lhs[i] / rhs[i];
return tmp;
}
| Matrix<T> QuadProgPP::operator/ | ( | const Matrix< T > & | lhs, |
| const T & | a | ||
| ) |
Definition at line 1509 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] / a;
return tmp;
}
| Vector<T> QuadProgPP::operator/ | ( | const Vector< T > & | lhs, |
| const T & | a | ||
| ) | [inline] |
Definition at line 408 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = lhs[i] / a;
return tmp;
}
| Matrix<T> QuadProgPP::operator/ | ( | const T & | a, |
| const Matrix< T > & | rhs | ||
| ) |
Definition at line 1520 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Matrix<T> tmp(rhs.nrows(), rhs.ncols());
for (unsigned int i = 0; i < rhs.nrows(); i++)
for (unsigned int j = 0; j < rhs.ncols(); j++)
tmp[i][j] = a / rhs[i][j];
return tmp;
}
| bool QuadProgPP::operator< | ( | const Vector< T > & | v, |
| const Vector< T > & | w | ||
| ) | [inline] |
| std::ostream& QuadProgPP::operator<< | ( | std::ostream & | os, |
| const Matrix< T > & | m | ||
| ) |
Input/Output
Definition at line 1627 of file Array.h.
{
os << std::endl << m.nrows() << " " << m.ncols() << std::endl;
for (unsigned int i = 0; i < m.nrows(); i++)
{
for (unsigned int j = 0; j < m.ncols() - 1; j++)
os << std::setw(20) << std::setprecision(16) << m[i][j] << ", ";
os << std::setw(20) << std::setprecision(16) << m[i][m.ncols() - 1] << std::endl;
}
return os;
}
| std::ostream& QuadProgPP::operator<< | ( | std::ostream & | os, |
| const Vector< T > & | v | ||
| ) | [inline] |
| bool QuadProgPP::operator<= | ( | const Vector< T > & | v, |
| const Vector< T > & | w | ||
| ) | [inline] |
| bool QuadProgPP::operator== | ( | const Matrix< T > & | a, |
| const Matrix< T > & | b | ||
| ) | [inline] |
Definition at line 1598 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
if (a.nrows() != b.nrows() || a.ncols() != b.ncols())
throw std::logic_error("Matrices of different size are not confrontable");
for (unsigned i = 0; i < a.nrows(); i++)
for (unsigned j = 0; j < a.ncols(); j++)
if (a[i][j] != b[i][j])
return false;
return true;
}
| bool QuadProgPP::operator== | ( | const Vector< T > & | v, |
| const Vector< T > & | w | ||
| ) | [inline] |
Definition at line 480 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
if (v.size() != w.size())
throw std::logic_error("Vectors of different size are not confrontable");
for (unsigned i = 0; i < v.size(); i++)
if (v[i] != w[i])
return false;
return true;
}
| bool QuadProgPP::operator> | ( | const Vector< T > & | v, |
| const Vector< T > & | w | ||
| ) | [inline] |
Definition at line 524 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
if (v.size() != w.size())
throw std::logic_error("Vectors of different size are not confrontable");
for (unsigned i = 0; i < v.size(); i++)
if (v[i] <= w[i])
return false;
return true;
}
| bool QuadProgPP::operator>= | ( | const Vector< T > & | v, |
| const Vector< T > & | w | ||
| ) | [inline] |
Definition at line 535 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
if (v.size() != w.size())
throw std::logic_error("Vectors of different size are not confrontable");
for (unsigned i = 0; i < v.size(); i++)
if (v[i] < w[i])
return false;
return true;
}
| std::istream& QuadProgPP::operator>> | ( | std::istream & | is, |
| Matrix< T > & | m | ||
| ) |
Definition at line 1641 of file Array.h.
References QuadProgPP::Matrix< T >::resize().
{
int rows, cols;
char comma;
is >> rows >> cols;
m.resize(rows, cols);
for (unsigned int i = 0; i < rows; i++)
for (unsigned int j = 0; j < cols; j++)
is >> m[i][j] >> comma;
return is;
}
| std::istream& QuadProgPP::operator>> | ( | std::istream & | is, |
| Vector< T > & | v | ||
| ) |
Definition at line 560 of file Array.h.
References QuadProgPP::Vector< T >::resize().
{
int elements;
char comma;
is >> elements;
v.resize(elements);
for (unsigned int i = 0; i < elements; i++)
is >> v[i] >> comma;
return is;
}
| Vector<T> QuadProgPP::operator^ | ( | const Vector< T > & | lhs, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 428 of file Array.h.
References pow(), and QuadProgPP::Vector< T >::size().
{
if (lhs.size() != rhs.size())
throw std::logic_error("Operator^: vectors have different sizes");
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = pow(lhs[i], rhs[i]);
return tmp;
}
| Vector<T> QuadProgPP::operator^ | ( | const Vector< T > & | lhs, |
| const T & | a | ||
| ) | [inline] |
Definition at line 440 of file Array.h.
References pow(), and QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(lhs.size());
for (unsigned int i = 0; i < lhs.size(); i++)
tmp[i] = pow(lhs[i], a);
return tmp;
}
| Vector<T> QuadProgPP::operator^ | ( | const T & | a, |
| const Vector< T > & | rhs | ||
| ) | [inline] |
Definition at line 450 of file Array.h.
References pow(), and QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(rhs.size());
for (unsigned int i = 0; i < rhs.size(); i++)
tmp[i] = pow(a, rhs[i]);
return tmp;
}
| Matrix<T> QuadProgPP::operator^ | ( | const Matrix< T > & | lhs, |
| const T & | a | ||
| ) |
Definition at line 1553 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and pow().
{
Matrix<T> tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = pow(lhs[i][j], a);
return tmp;
}
| unsigned int QuadProgPP::partition | ( | Vector< T > & | v, |
| unsigned int | begin, | ||
| unsigned int | end | ||
| ) | [inline] |
Definition at line 786 of file Array.h.
Referenced by quicksort().
{
unsigned int i = begin + 1, j = begin + 1;
T pivot = v[begin];
while (j <= end)
{
if (v[j] < pivot) {
std::swap(v[i], v[j]);
i++;
}
j++;
}
v[begin] = v[i - 1];
v[i - 1] = pivot;
return i - 2;
}
| Matrix<T> QuadProgPP::pinv | ( | const Matrix< T > & | A ) |
Definition at line 1918 of file Array.h.
References DIAG, dot_prod(), QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), svd(), and t().
{
Matrix<T> U, V, x, tmp(A.ncols(), A.nrows());
Vector<T> W;
CanonicalBaseVector<T> e(0, A.nrows());
svd(A, U, W, V);
for (unsigned int i = 0; i < A.nrows(); i++)
{
e.reset(i);
tmp.setColumn(i, dot_prod(dot_prod(dot_prod(V, Matrix<double>(DIAG, 1.0 / W, 0.0, W.size(), W.size())), t(U)), e));
}
return tmp;
}
| Vector<T> QuadProgPP::pow | ( | const Vector< T > & | v, |
| double | a | ||
| ) | [inline] |
Definition at line 756 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by QwtLog10ScaleEngine::autoScale(), QwtScaleArithmetic::ceil125(), QwtSimpleCompassRose::drawRose(), QwtScaleArithmetic::floor125(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetGeneralizedGFA(), mitk::UIDGenerator::GetUID(), mitk::Ellipsoid::IsInside(), mitk::Cylinder::IsInside(), itk::AnalyticalDiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NOrderL, NrOdfDirections >::legendre0(), operator^(), QuadProgPP::Matrix< T >::operator^=(), QuadProgPP::Vector< T >::operator^=(), QwtLog10ScaleEngine::pow10(), RGBtoHSI(), mitk::LevelWindow::SetAuto(), itk::AnalyticalDiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NOrderL, NrOdfDirections >::spherical_harmonic(), vtkPointSetSlicer::UnstructuredGridCutter(), vtkMitkVolumeTextureMapper3D::UpdateColorLookup(), and QwtMagnifier::widgetWheelEvent().
{
Vector<T> tmp(v.size());
for (unsigned int i = 0; i < v.size(); i++)
tmp[i] = pow(v[i], a);
return tmp;
}
| void QuadProgPP::print_matrix | ( | const char * | name, |
| const Matrix< double > & | A, | ||
| int | n = -1, |
||
| int | m = -1 |
||
| ) |
Definition at line 783 of file QuadProg.cpp.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and t().
Referenced by add_constraint(), cholesky_decomposition(), and QuadProgPP::QuadProg::solve_quadprog().
{
std::ostringstream s;
std::string t;
if (n == -1)
n = A.nrows();
if (m == -1)
m = A.ncols();
s << name << ": " << std::endl;
for (int i = 0; i < n; i++)
{
s << " ";
for (int j = 0; j < m; j++)
s << A[i][j] << ", ";
s << std::endl;
}
t = s.str();
t = t.substr(0, t.size() - 3); // To remove the trailing space, comma and newline
std::cout << t << std::endl;
}
| void QuadProgPP::print_vector | ( | const char * | name, |
| const Vector< T > & | v, | ||
| int | n = -1 |
||
| ) |
Definition at line 807 of file QuadProg.cpp.
References QuadProgPP::Vector< T >::size(), and t().
Referenced by add_constraint(), and QuadProgPP::QuadProg::solve_quadprog().
{
std::ostringstream s;
std::string t;
if (n == -1)
n = v.size();
s << name << ": " << std::endl << " ";
for (int i = 0; i < n; i++)
{
s << v[i] << ", ";
}
t = s.str();
t = t.substr(0, t.size() - 2); // To remove the trailing space and comma
std::cout << t << std::endl;
}
| T QuadProgPP::prod | ( | const Vector< T > & | v ) | [inline] |
Definition at line 616 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by lu_det().
{
T tmp = (T)1;
for (unsigned int i = 0; i < v.size(); i++)
tmp *= v[i];
return tmp;
}
| Vector<T> QuadProgPP::prod | ( | const Matrix< T > & | m ) |
Definition at line 2239 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> tmp((T)1, m.ncols());
for (unsigned int j = 0; j < m.ncols(); j++)
for (unsigned int i = 0; i < m.nrows(); i++)
tmp[j] *= m[i][j];
return tmp;
}
| void QuadProgPP::quicksort | ( | Vector< T > & | v, |
| unsigned int | begin, | ||
| unsigned int | end | ||
| ) | [inline] |
| Vector<T> QuadProgPP::r_max | ( | const Matrix< T > & | m ) |
Definition at line 2381 of file Array.h.
References max(), QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> res(m.nrows());
double value;
for (unsigned int i = 0; i < m.nrows(); i++)
{
value = m[i][0];
for (unsigned int j = 1; j < m.ncols(); j++)
value = std::max(m[i][j], value);
res[i] = value;
}
return res;
}
| Vector<T> QuadProgPP::r_mean | ( | const Matrix< T > & | m ) |
Definition at line 2283 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> res((T)0, m.rows());
for (unsigned int i = 0; i < m.nrows(); i++)
{
for (unsigned int j = 0; j < m.ncols(); j++)
res[i] += m[i][j];
res[i] /= m.nrows();
}
return res;
}
| Vector<T> QuadProgPP::r_min | ( | const Matrix< T > & | m ) |
Definition at line 2413 of file Array.h.
References min, QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> res(m.nrows());
double value;
for (unsigned int i = 0; i < m.nrows(); i++)
{
value = m[i][0];
for (unsigned int j = 1; j < m.ncols(); j++)
value = std::min(m[i][j], value);
res[i] = value;
}
return res;
}
| Vector<T> QuadProgPP::r_prod | ( | const Matrix< T > & | m ) |
Definition at line 2249 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> tmp((T)1, m.nrows());
for (unsigned int i = 0; i < m.nrows(); i++)
for (unsigned int j = 0; j < m.ncols(); j++)
tmp[i] *= m[i][j];
return tmp;
}
| Matrix<double> QuadProgPP::r_rank | ( | const Matrix< T > | m ) | [inline] |
Definition at line 2544 of file Array.h.
References QuadProgPP::Matrix< T >::extractRow(), QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and QuadProgPP::Matrix< T >::setRow().
{
Matrix<double> tmp(m.nrows(), m.ncols());
for (unsigned int i = 0; i < m.nrows(); i++)
tmp.setRow(i, rank<T>(m.extractRow(i)));
return tmp;
}
| Vector<T> QuadProgPP::r_stdev | ( | const Matrix< T > & | m, |
| bool | sample_correction = false |
||
| ) |
| Vector<T> QuadProgPP::r_sum | ( | const Matrix< T > & | m ) |
Definition at line 2219 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> tmp((T)0, m.nrows());
for (unsigned int i = 0; i < m.nrows(); i++)
for (unsigned int j = 0; j < m.ncols(); j++)
tmp[i] += m[i][j];
return tmp;
}
| Vector<T> QuadProgPP::r_var | ( | const Matrix< T > & | m, |
| bool | sample_correction = false |
||
| ) |
Definition at line 2336 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and sum().
Referenced by r_stdev().
{
Vector<T> res((T)0, m.nrows());
double sum, ssum;
unsigned int n = m.ncols();
for (unsigned int i = 0; i < m.nrows(); i++)
{
sum = 0.0; ssum = 0.0;
for (unsigned int j = 0; j < m.ncols(); j++)
{
sum += m[i][j];
ssum += (m[i][j] * m[i][j]);
}
if (!sample_correction)
res[i] = (ssum / n) - (sum / n) * (sum / n);
else
res[i] = n * ((ssum / n) - (sum / n) * (sum / n)) / (n - 1);
}
return res;
}
| void QuadProgPP::random | ( | Matrix< T > & | m ) |
Definition at line 2197 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
for (unsigned int i = 0; i < m.nrows(); i++)
for (unsigned int j = 0; j < m.ncols(); j++)
m[i][j] = (T)(rand() / double(RAND_MAX));
}
| Vector<double> QuadProgPP::rank | ( | const Vector< T > & | v ) | [inline] |
Definition at line 826 of file Array.h.
References QuadProgPP::Vector< T >::size().
{
Vector<T> tmp(v);
Vector<double> tmp_rank(0.0, v.size());
for (unsigned int i = 0; i < tmp.size(); i++)
{
unsigned int smaller = 0, equal = 0;
for (unsigned int j = 0; j < tmp.size(); j++)
if (i == j)
continue;
else
if (tmp[j] < tmp[i])
smaller++;
else if (tmp[j] == tmp[i])
equal++;
tmp_rank[i] = smaller + 1;
if (equal > 0)
{
for (unsigned int j = 1; j <= equal; j++)
tmp_rank[i] += smaller + 1 + j;
tmp_rank[i] /= (double)(equal + 1);
}
}
return tmp_rank;
}
| Matrix<double> QuadProgPP::rank | ( | const Matrix< T > | m ) | [inline] |
Definition at line 2534 of file Array.h.
References QuadProgPP::Matrix< T >::extractColumn(), QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and QuadProgPP::Matrix< T >::setColumn().
{
Matrix<double> tmp(m.nrows(), m.ncols());
for (unsigned int j = 0; j < m.ncols(); j++)
tmp.setColumn(j, rank<T>(m.extractColumn(j)));
return tmp;
}
| double QuadProgPP::scalar_product | ( | const Vector< double > & | x, |
| const Vector< double > & | y | ||
| ) | [inline] |
Definition at line 700 of file QuadProg.cpp.
References QuadProgPP::Vector< T >::size(), and sum().
Referenced by QuadProgPP::QuadProg::solve_quadprog().
| std::set< unsigned int > QuadProgPP::seq | ( | unsigned int | s, |
| unsigned int | e | ||
| ) |
| Vector<T> QuadProgPP::sign | ( | const Vector< T > & | v ) | [inline] |
Definition at line 776 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by svd().
{
Vector<T> tmp(v.size());
for (unsigned int i = 0; i < v.size(); i++)
tmp[i] = v[i] > 0 ? +1 : v[i] == 0 ? 0 : -1;
return tmp;
}
| T QuadProgPP::sign | ( | const T & | v ) |
| std::set< unsigned int > QuadProgPP::singleton | ( | unsigned int | i ) |
| Vector<T> QuadProgPP::sort | ( | const Vector< T > & | v ) | [inline] |
Definition at line 816 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetNeighbors(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetPrincipleCurvature(), median(), mitk::MeshMapper2D::Paint(), mitk::Geometry2DDataMapper2D::Paint(), QmitkOverlayController::RestackOverlays(), and itk::DiffusionQballGeneralizedFaImageFilter< TOdfPixelType, TGfaPixelType, NrOdfDirections >::ThreadedGenerateData().
{
Vector<T> tmp(v);
quicksort<T>(tmp, 0, tmp.size() - 1);
return tmp;
}
| Vector<T> QuadProgPP::sqrt | ( | const Vector< T > & | v ) | [inline] |
Definition at line 746 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by QwtSpline::buildPeriodicSpline(), mitk::CylindricToCartesianFilter::buildTransformShortCuts(), mitk::SlicedGeometry3D::CalculateSpacing(), mitk::ImageMapperGL2D::CalculateSpacing(), mitk::SurfaceInteractor::CanHandleEvent(), itk::AnalyticalDiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NOrderL, NrOdfDirections >::Cart2Sph(), QmitkPointBasedRegistrationView::checkLandmarkError(), cholesky(), cholesky_decomposition(), QwtPlotCurve::closestPoint(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::ComputeBaseMesh(), itk::DiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NrOdfDirections, NrBasisFunctionCenters >::ComputeReconstructionMatrix(), MeshUtil< MeshType, ScalarAccessor >::CreateRegularSphereMesh2(), QmitkDiffusionDicomImport::DicomLoadStartLoad(), dist(), distance(), itk::PointShell< NPoints, TMatrixType >::DistributePointShell(), QwtRoundScaleDraw::extent(), mitk::Geometry3D::GetDiagonalLength(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetGeneralizedFractionalAnisotropy(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetGeneralizedGFA(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetInterpolatedComponent(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetMaxChordLength(), mitk::ClaronInterface::GetQuaternions(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetStdDevByMaxValue(), mitk::ClaronInterface::GetTipQuaternions(), ipMITKSegmentationGetCutPoints(), ipMITKSegmentationGetDistGradient(), mitk::Cone::IsInside(), mitk::CalculateGrayValueStatisticsTool::ITKHistogramming(), mitk::OdfVtkMapper2D< TPixelType, NrOdfDirections >::MeasureDisplayedGeometry(), mitkNavigationDataLandmarkTransformFilterTest(), mitk::SpaceNavigatorVtkCameraController::OnSpaceNavigatorEvent(), mitk::TDMouseVtkCameraController::OnTDMouseEvent(), mitk::SurfaceGLMapper2D::PaintCells(), r_stdev(), RGBtoHSI(), vtkThickPlane::SetNormal(), itk::AnalyticalDiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NOrderL, NrOdfDirections >::spherical_harmonic(), sqrt(), ANNsampStat::stdDev(), stdev(), svd(), mitkPlanarCrossTestClass::TestPlanarCrossPlacement(), mitkPlanarCrossTestClass::TestPlanarCrossPlacementSingleLine(), itk::LocalVariationImageFilter< TInputImage, TOutputImage >::ThreadedGenerateData(), itk::AnalyticalDiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NOrderL, NrOdfDirections >::ThreadedGenerateData(), mitk::CorrectorAlgorithm::TobiasHeimannCorrectionAlgorithm(), mitk::SiemensMosaicDicomDiffusionImageHeaderReader::Update(), and itk::AnalyticalDiffusionQballReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TOdfPixelType, NOrderL, NrOdfDirections >::Yj().
{
Vector<T> tmp(v.size());
for (unsigned int i = 0; i < v.size(); i++)
tmp[i] = sqrt(v[i]);
return tmp;
}
| Matrix<T> QuadProgPP::sqrt | ( | const Matrix< T > & | m ) |
Definition at line 2447 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and sqrt().
{
Matrix<T> tmp(m.nrows(), m.ncols());
for (unsigned int i = 0; i < m.nrows(); i++)
for (unsigned int j = 0; j < m.ncols(); j++)
tmp[i][j] = sqrt(m[i][j]);
return tmp;
}
| T QuadProgPP::stdev | ( | const Vector< T > & | v, |
| bool | sample_correction = false |
||
| ) | [inline] |
| Vector<T> QuadProgPP::stdev | ( | const Matrix< T > & | m, |
| bool | sample_correction = false |
||
| ) |
| Vector<T> QuadProgPP::sum | ( | const Matrix< T > & | m ) |
Aggregate functions
Definition at line 2209 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
{
Vector<T> tmp((T)0, m.ncols());
for (unsigned int j = 0; j < m.ncols(); j++)
for (unsigned int i = 0; i < m.nrows(); i++)
tmp[j] += m[i][j];
return tmp;
}
| T QuadProgPP::sum | ( | const Vector< T > & | v ) | [inline] |
Definition at line 606 of file Array.h.
References QuadProgPP::Vector< T >::size().
Referenced by QwtSpline::buildPeriodicSpline(), cholesky(), cholesky_decomposition(), mitk::VolumeVisualizationImagePreprocessor::Composite(), compute_d(), dot_prod(), itk::NonUniformBSpline< TDimension >::EvaluateSpline(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::GetInterpolatedComponent(), lu_solve(), mean(), ANNsampStat::mean(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::Normalize(), ANNsampStat::operator+=(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::PostMultiply(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::PreMultiply(), r_var(), ANNsampStat::reset(), RGBtoHSI(), scalar_product(), QuadProgPP::QuadProg::solve_quadprog(), ANNsampStat::stdDev(), itk::TensorToL2NormImageFilter< TInputImage, TOutputImage >::ThreadedGenerateData(), update_r(), var(), and vtkMitkThickSlicesFilterExecute().
{
T tmp = (T)0;
for (unsigned int i = 0; i < v.size(); i++)
tmp += v[i];
return tmp;
}
| void QuadProgPP::svd | ( | const Matrix< T > & | A, |
| Matrix< T > & | U, | ||
| Vector< T > & | W, | ||
| Matrix< T > & | V | ||
| ) |
Definition at line 1674 of file Array.h.
References dist(), max(), min, QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), QuadProgPP::Matrix< T >::resize(), QuadProgPP::Vector< T >::resize(), sign(), and sqrt().
Referenced by pinv(), and mitk::PlaneFit::ProcessPointSet().
{
int m = A.nrows(), n = A.ncols(), i, j, k, l, jj, nm;
const unsigned int max_its = 30;
bool flag;
Vector<T> rv1(n);
U = A;
W.resize(n);
V.resize(n, n);
T anorm, c, f, g, h, s, scale, x, y, z;
g = scale = anorm = (T)0.0;
// Householder reduction to bidiagonal form
for (i = 0; i < n; i++)
{
l = i + 1;
rv1[i] = scale * g;
g = s = scale = (T)0.0;
if (i < m)
{
for (k = i; k < m; k++)
scale += fabs(U[k][i]);
if (scale != (T)0.0)
{
for (k = i; k < m; k++)
{
U[k][i] /= scale;
s += U[k][i] * U[k][i];
}
f = U[i][i];
g = -sign(f) * sqrt(s);
h = f * g - s;
U[i][i] = f - g;
for (j = l; j < n; j++)
{
s = (T)0.0;
for (k = i; k < m; k++)
s += U[k][i] * U[k][j];
f = s / h;
for (k = i; k < m; k++)
U[k][j] += f * U[k][i];
}
for (k = i; k < m; k++)
U[k][i] *= scale;
}
}
W[i] = scale * g;
g = s = scale = (T)0.0;
if (i < m && i != n - 1)
{
for (k = l; k < n; k++)
scale += fabs(U[i][k]);
if (scale != (T)0.0)
{
for (k = l; k < n; k++)
{
U[i][k] /= scale;
s += U[i][k] * U[i][k];
}
f = U[i][l];
g = -sign(f) * sqrt(s);
h = f * g - s;
U[i][l] = f - g;
for (k = l; k <n; k++)
rv1[k] = U[i][k] / h;
for (j = l; j < m; j++)
{
s = (T)0.0;
for (k = l; k < n; k++)
s += U[j][k] * U[i][k];
for (k = l; k < n; k++)
U[j][k] += s * rv1[k];
}
for (k = l; k < n; k++)
U[i][k] *= scale;
}
}
anorm = std::max(anorm, fabs(W[i]) + fabs(rv1[i]));
}
// Accumulation of right-hand transformations
for (i = n - 1; i >= 0; i--)
{
if (i < n - 1)
{
if (g != (T)0.0)
{
for (j = l; j < n; j++)
V[j][i] = (U[i][j] / U[i][l]) / g;
for (j = l; j < n; j++)
{
s = (T)0.0;
for (k = l; k < n; k++)
s += U[i][k] * V[k][j];
for (k = l; k < n; k++)
V[k][j] += s * V[k][i];
}
}
for (j = l; j < n; j++)
V[i][j] = V[j][i] = (T)0.0;
}
V[i][i] = (T)1.0;
g = rv1[i];
l = i;
}
// Accumulation of left-hand transformations
for (i = std::min(m, n) - 1; i >= 0; i--)
{
l = i + 1;
g = W[i];
for (j = l; j < n; j++)
U[i][j] = (T)0.0;
if (g != (T)0.0)
{
g = (T)1.0 / g;
for (j = l; j < n; j++)
{
s = (T)0.0;
for (k = l; k < m; k++)
s += U[k][i] * U[k][j];
f = (s / U[i][i]) * g;
for (k = i; k < m; k++)
U[k][j] += f * U[k][i];
}
for (j = i; j < m; j++)
U[j][i] *= g;
}
else
for (j = i; j < m; j++)
U[j][i] = (T)0.0;
U[i][i]++;
}
// Diagonalization of the bidiagonal form: loop over singular values, and over allowed iterations.
for (k = n - 1; k >= 0; k--)
{
for (unsigned int its = 0; its < max_its; its++)
{
flag = true;
for (l = k; l >= 0; l--) // FIXME: in NR it was l >= 1 but there subscripts start from one
{ // Test for splitting
nm = l - 1; // Note that rV[0] is always zero
if ((T)(fabs(rv1[l]) + anorm) == anorm)
{
flag = false;
break;
}
if ((T)(fabs(W[nm]) + anorm) == anorm)
break;
}
if (flag)
{
// Cancellation of rv1[l], if l > 0 FIXME: it was l > 1 in NR
c = (T)0.0;
s = (T)1.0;
for (i = l; i <= k; i++)
{
f = s * rv1[i];
rv1[i] *= c;
if ((T)(fabs(f) + anorm) == anorm)
break;
g = W[i];
h = dist(f, g);
W[i] = h;
h = (T)1.0 / h;
c = g * h;
s = -f * h;
for (j = 0; j < m; j++)
{
y = U[j][nm];
z = U[j][i];
U[j][nm] = y * c + z * s;
U[j][i] = z * c - y * s;
}
}
}
z = W[k];
if (l == k)
{ // Convergence
if (z < (T)0.0)
{ // Singular value is made nonnegative
W[k] = -z;
for (j = 0; j < n; j++)
V[j][k] = -V[j][k];
}
break;
}
if (its == max_its)
throw std::logic_error("Error svd: no convergence in the maximum number of iterations");
x = W[l];
nm = k - 1;
y = W[nm];
g = rv1[nm];
h = rv1[k];
f = ((y - z) * (y + z) + (g - h) * (g + h)) / (2.0 * h * y);
g = dist(f, (T)1.0);
f = ((x - z) * (x + z) + h * ((y / (f + sign(f)*fabs(g))) - h)) / x;
c = s = (T)1.0; // Next QR transformation
for (j = l; j <= nm; j++)
{
i = j + 1;
g = rv1[i];
y = W[i];
h = s * g;
g *= c;
z = dist(f, h);
rv1[j] = z;
c = f / z;
s = h / z;
f = x * c + g * s;
g = g * c - x * s;
h = y * s;
y *= c;
for (jj = 0; jj < n; jj++)
{
x = V[jj][j];
z = V[jj][i];
V[jj][j] = x * c + z * s;
V[jj][i] = z * c - x * s;
}
z = dist(f, h);
W[j] = z;
if (z != 0) // Rotation can be arbitrary if z = 0
{
z = (T)1.0 / z;
c = f * z;
s = h * z;
}
f = c * g + s * y;
x = c * y - s * g;
for (jj = 0; jj < m; jj++)
{
y = U[jj][j];
z = U[jj][i];
U[jj][j] = y * c + z * s;
U[jj][i] = z * c - y * s;
}
}
rv1[l] = (T)0.0;
rv1[k] = f;
W[k] = x;
}
}
}
| Matrix<T> QuadProgPP::t | ( | const Matrix< T > & | a ) |
Definition at line 2474 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), and QuadProgPP::Matrix< T >::nrows().
Referenced by mitk::VirtualTrackingDevice::AddTool(), mitk::NDITrackingDevice::AddTool(), mitk::ClaronTrackingDevice::AddTool(), ANNkd_leaf::ann_FR_search(), ANNkd_leaf::ann_pri_search(), ANNkd_leaf::ann_search(), annBoxDistance(), mitk::PolygonToRingFilter::BuildPointAndVectorList(), mitk::InterpolateLinesFilter::BuildPointAndVectorList(), mitk::PlaneFit::CalculateCentroid(), mitk::SurfaceDeformationInteractor3D::ColorizeSurface(), itk::NonUniformBSpline< TDimension >::ComputeControlPoints(), mitk::SimpleHistogram::ComputeFromImage(), mitk::Image::ComputeImageStatistics(), vtkMitkVolumeTextureMapper3D::ComputePolygons(), mitk::VolumeCalculator::ComputeVolumeFromImageStatistics(), vtkPointSetSlicer::ContourUnstructuredGridCell(), mitk::TimeSlicedGeometry::CopyTimes(), QmitkControlVisualizationPropertiesView::CreateQtPartControl(), mitkPointSetFileIOTestClass::CreateTestPointSet(), cutPoint(), distance(), mitk::MessageDelegate4< R, T, U, V, W, A >::Execute(), mitk::MessageDelegate3< R, T, U, V, A >::Execute(), mitk::MessageDelegate2< R, T, U, A >::Execute(), mitk::MessageDelegate1< R, T, A >::Execute(), mitk::SurfaceDeformationInteractor3D::ExecuteAction(), mitk::NDITrackingDevice::FreePortHandles(), mitk::UnstructuredGridVtkWriter< VTKWRITER >::GenerateData(), mitk::TrackingDeviceSource::GenerateData(), mitk::SurfaceVtkWriter< VTKWRITER >::GenerateData(), mitk::SurfaceToImageFilter::GenerateData(), mitk::RGBToRGBACastImageFilter::GenerateData(), mitk::ProbeFilter::GenerateData(), mitk::PolygonToRingFilter::GenerateData(), mitk::PlaneFit::GenerateData(), mitk::PicVolumeTimeSeriesReader::GenerateData(), mitk::ParRecFileReader::GenerateData(), mitk::MaskImageFilter::GenerateData(), mitk::ManualSegmentationToSurfaceFilter::GenerateData(), mitk::LabeledImageToSurfaceFilter::GenerateData(), mitk::ImageWriter::GenerateData(), mitk::ImageToSurfaceFilter::GenerateData(), mitk::GeometryClipImageFilter::GenerateData(), mitk::DopplerToStrainRateFilter::GenerateData(), mitk::CylindricToCartesianFilter::GenerateData(), mitk::AngleCorrectByPointFilter::GenerateData(), mitk::PlanarAngle::GenerateHelperPolyLine(), mitk::PlaneFit::GenerateOutputInformation(), mitk::PlanarCircle::GeneratePolyLine(), mitk::Mesh::GetBoundingBoxFromCell(), mitk::PlaneFit::GetCentroid(), mitk::Image::GetChannelData(), mitk::Image::GetCountOfMaxValuedVoxels(), mitk::Image::GetCountOfMaxValuedVoxelsNoRecompute(), mitk::Image::GetCountOfMinValuedVoxels(), mitk::Image::GetCountOfMinValuedVoxelsNoRecompute(), mitk::BaseData::GetGeometry(), mitk::TimeSlicedGeometry::GetGeometry3D(), mitk::Mesh::GetMesh(), mitk::MicroBirdTrackingDevice::GetMicroBirdTool(), mitk::Mesh::GetNewCellId(), mitk::Mesh::GetNumberOfCells(), mitk::PointSet::GetNumberOfSelected(), mitk::PlaneFit::GetPlaneGeometry(), mitk::PlaneFit::GetPlaneNormal(), mitk::PointSet::GetPoint(), mitk::Line< TCoordRep, NPointDimension >::GetPoint(), mitk::NonBlockingAlgorithm::GetPointerParameter(), mitk::Mesh::GetPointIds(), mitk::PointSet::GetPointSet(), mitk::Image::GetScalarValue2ndMax(), mitk::Image::GetScalarValue2ndMaxNoRecompute(), mitk::Image::GetScalarValue2ndMin(), mitk::Image::GetScalarValue2ndMinNoRecompute(), mitk::Image::GetScalarValueMax(), mitk::Image::GetScalarValueMaxNoRecompute(), mitk::Image::GetScalarValueMin(), mitk::Image::GetScalarValueMinNoRecompute(), mitk::PointSet::GetSelectInfo(), mitk::PointSet::GetSize(), mitk::PointSet::GetSpecificationTypeInfo(), mitk::VirtualTrackingDevice::GetSplineChordLength(), QmitkNDIConfigurationWidget::GetToolNamesList(), mitk::UIDGenerator::GetUID(), mitk::Surface::GetVtkPolyData(), mitk::UnstructuredGrid::GetVtkUnstructuredGrid(), mitk::ColorConversions::Hsv2Rgb(), mitk::PointSet::IndexExists(), mitk::TimeSlicedGeometry::InitializeGeometry(), mitk::PlaneFit::InitializePlane(), mitk::PointSet::InsertPoint(), mitk::Image::IsChannelSet(), mitk::BaseData::IsEmpty(), MeshUtil< MeshType, ScalarAccessor >::MeshFromPolyData(), mitk::TimeSlicedGeometry::MSToTimeStep(), itk::NonUniformBSpline< TDimension >::NonUniformBSplineFunctionRecursive(), QmitkIGTExampleView::OnTestTracking(), QmitkTbssView::OutputUnconnectedPointValues(), mitk::MeshMapper2D::Paint(), mitk::Geometry2DDataMapper2D::Paint(), pinv(), mitkPointSetFileIOTestClass::PointSetCompare(), mitk::NDIProtocol::POS3D(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::PostMultiply(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::PreMultiply(), print_matrix(), print_vector(), mitk::PlaneFit::ProcessPointSet(), mitk::Line< TCoordRep, NPointDimension >::RectangleLineIntersection(), mitk::UnstructuredGrid::RequestedRegionIsOutsideOfTheBufferedRegion(), mitk::Surface::RequestedRegionIsOutsideOfTheBufferedRegion(), mitk::SlicedData::RequestedRegionIsOutsideOfTheBufferedRegion(), mitk::Mesh::SearchFirstCell(), mitk::Mesh::SearchLine(), mitk::PointSet::SearchPoint(), mitk::Mesh::SearchSelectedCell(), mitk::PointSet::SearchSelectedPoint(), mitk::TimeSlicedGeometry::SetGeometry3D(), mitk::TimeSlicedGeometry::SetImageGeometry(), mitk::ImageStatisticsCalculator::SetImageMask(), mitk::PlaneFit::SetInput(), mitk::ImageStatisticsCalculator::SetMaskingModeToImage(), mitk::Mesh::SetMesh(), mitk::PointSet::SetPoint(), QmitkPointListViewWidget::SetTimeStep(), QmitkPointListModel::SetTimeStep(), QwtScaleWidget::setTitle(), mitk::VirtualTrackingDevice::SetToolSpeed(), QwtAbstractSlider::setUpdateTime(), mitk::Surface::SetVtkPolyData(), mitk::UnstructuredGrid::SetVtkUnstructuredGrid(), QuadProgPP::QuadProg::solve_quadprog(), mitk::VirtualTrackingDevice::TrackTools(), mitk::TimeSlicedGeometry::UpdateInformation(), QmitkVtkLineProfileWidget::UpdateItemModelFromPath(), mitk::SplineVtkMapper3D::UpdateSpline(), QmitkNDIConfigurationWidget::UpdateToolTable(), and ScalarGradientCompute< T >::write().
{
Matrix<T> tmp(a.ncols(), a.nrows());
for (unsigned int i = 0; i < a.nrows(); i++)
for (unsigned int j = 0; j < a.ncols(); j++)
tmp[j][i] = a[i][j];
return tmp;
}
| void QuadProgPP::update_r | ( | const Matrix< double > & | R, |
| Vector< double > & | r, | ||
| const Vector< double > & | d, | ||
| int | iq | ||
| ) | [inline] |
Definition at line 517 of file QuadProg.cpp.
References sum().
Referenced by QuadProgPP::QuadProg::solve_quadprog().
| void QuadProgPP::update_z | ( | Vector< double > & | z, |
| const Matrix< double > & | J, | ||
| const Vector< double > & | d, | ||
| int | iq | ||
| ) | [inline] |
Definition at line 504 of file QuadProg.cpp.
References QuadProgPP::Vector< T >::size().
Referenced by QuadProgPP::QuadProg::solve_quadprog().
{
register int i, j, n = z.size();
/* setting of z = H * d */
for (i = 0; i < n; i++)
{
z[i] = 0.0;
for (j = iq; j < n; j++)
z[i] += J[i][j] * d[j];
}
}
| T QuadProgPP::var | ( | const Vector< T > & | v, |
| bool | sample_correction = false |
||
| ) | [inline] |
Definition at line 651 of file Array.h.
References QuadProgPP::Vector< T >::size(), and sum().
Referenced by stdev().
{
T sum = (T)0, ssum = (T)0;
unsigned int n = v.size();
for (unsigned int i = 0; i < n; i++)
{
sum += v[i];
ssum += (v[i] * v[i]);
}
if (!sample_correction)
return (ssum / n) - (sum / n) * (sum / n);
else
return n * ((ssum / n) - (sum / n) * (sum / n)) / (n - 1);
}
| Vector<T> QuadProgPP::var | ( | const Matrix< T > & | m, |
| bool | sample_correction = false |
||
| ) |
Definition at line 2307 of file Array.h.
References QuadProgPP::Matrix< T >::ncols(), QuadProgPP::Matrix< T >::nrows(), and sum().
{
Vector<T> res((T)0, m.ncols());
unsigned int n = m.nrows();
double sum, ssum;
for (unsigned int j = 0; j < m.ncols(); j++)
{
sum = (T)0.0; ssum = (T)0.0;
for (unsigned int i = 0; i < m.nrows(); i++)
{
sum += m[i][j];
ssum += (m[i][j] * m[i][j]);
}
if (!sample_correction)
res[j] = (ssum / n) - (sum / n) * (sum / n);
else
res[j] = n * ((ssum / n) - (sum / n) * (sum / n)) / (n - 1);
}
return res;
}
1.7.2