linear_constraints(data_types=None,
scaling_matrix=None)
| source code
|
Function for setting up the linear constraint matrices A and b.
Standard notation
The N-state model constraints are:
0 <= pc <= 1,
where p is the probability and c corresponds to state c.
Matrix notation
In the notation A.x >= b, where A is an matrix of coefficients, x
is an array of parameter values, and b is a vector of scalars, these
inequality constraints are:
| 1 0 0 | | 0 |
| | | |
|-1 0 0 | | -1 |
| | | |
| 0 1 0 | | 0 |
| | | p0 | | |
| 0 -1 0 | | | | -1 |
| | . | p1 | >= | |
| 0 0 1 | | | | 0 |
| | | p2 | | |
| 0 0 -1 | | -1 |
| | | |
|-1 -1 -1 | | -1 |
| | | |
| 1 1 1 | | 0 |
This example is for a 4-state model, the last probability pn is not
included as this parameter does not exist (because the sum of pc is
equal to 1). The Euler angle parameters have been excluded here but
will be included in the returned A and b objects. These parameters
simply add columns of zero to the A matrix and have no effect on b.
The last two rows correspond to the inequality:
0 <= pN <= 1.
As:
N-1
pN = 1 - > pc,
/__
c=1
then:
-p1 - p2 - ... - p(N-1) >= -1,
p1 + p2 + ... + p(N-1) >= 0.
- Parameters:
data_types (list of str) - The base data types used in the optimisation. This list can
contain the elements 'rdc', 'pcs' or 'tensor'.
scaling_matrix (numpy rank-2 square matrix) - The diagonal scaling matrix.
- Returns: tuple of len 2 of a numpy rank-2, size NxM matrix and numpy rank-1,
size N array
- The matrices A and b.
|