HP 15c User Manual

Page 97

Advertising
background image

Section 4: Using Matrix Operations

97

Only the first p + 1 rows (and columns) of V need to be retained. (Note that Q here is
not the same as that mentioned earlier, since this Q must also transform y.)

2. Solve the following system for b:

.

1

ˆ

q

q

0

b

0

g

U

(If q = 0, replace it by any small nonzero number, say 10

−99

.) The −1 in the solution

matrix automatically appears; it requires no additional calculations.

In the absence of rounding errors, q = ±||yXb||

F

; this may be inaccurate if |q| is too

small, say smaller than ||y||/l0

6

. If you desire a more accurate estimate of ||yXb||

F

,

you can calculate it directly from X, y, and the computed solution b.

For the weighted least-squares problem, replace X and y by WX and Wy, where W is the
diagonal matrix containing the weights.

For the linearly constrained least-squares problem, you must recognize that constraints may
be inconsistent. In addition, they can't always be satisfied exactly by a calculated solution
because of rounding errors. Therefore, you must specify a tolerance t such that the constraints
are said to be satisfied when ||Cbd|| < t. Certainly t > ||d||/10

10

for 10-digit computation,

and in some cases a much larger tolerance must be used.

Having chosen t, select a weight factor w that satisfies w > ||y||/t. For convenience, choose w
to be a power of 10 somewhat bigger than ||y||/t. Then w||Cbd|| > ||y|| unless ||Cbd|| < t.

However, the constraint may fail to be satisfied for one of two reasons:

No b exists for which ||Cbd|| < t.

The leading columns of C are nearly linearly dependent.

Check for the first situation by determining whether a solution exists for the constraints
alone. When [wC wd] has been factored to Q[U g], solve this system for b

)

row

1

(

)

rows

(

1

)

diag(

)

rows

1

(

)

rows

(

p

q

q

k

p

k

0

b

0

g

U

using any small nonzero number q. If the computed solution b satisfies Cbd, then the
constraints are not inconsistent.

The second situation is rarely encountered and can be avoided. It shows itself by causing at
least one of the diagonal elements of U to be much smaller than the largest element above it
in the same column, where U is from the orthogonal factorization wC = QU.

To avoid this situation, reorder the columns of wC and X and similarly reorder the elements
(rows) of b. The reordering can be chosen easily if the troublesome diagonal element of U is
also much smaller than some subsequent element in its row. Just swap the corresponding

Advertising