linear algebra - Calculating an inverse matrix in Matlab -


i'm running optimization algorithm requires calculation of inverse of matrix. goal of algorithm eliminate negative values matrix , obtain new matrix b. basically, start known square matrices b , c of same size.

i start calculating matrix equal to:

a = b^-1 * c

or in matlab:

a = b\c; 

i use because matlab told me b\c more accurate inv(b)*c.

the negative values in divided 2 , normalised it's rows have length of 1. using new a, calculate new b with:

(1/n) * * c' = b^-1

where n scaling factor (# of columns in a). new b used again in first step , these iterations continue until negatives in gone.

my problem have calculate b second equation , normalise it.

invb = (1/n)*a*c'; b = inv(invb); 

i've been calculating b using inv(b^-1) after few iterations start getting messages b^-1 "close singular or badly scaled."

this algorithm works smaller matrices (around 70x70) when gets 500x500 start getting these messages.

are there better ways calculate inv(b^-1)?

you should head warnings singular matrices. results in numerical linear algebra tend break down move toward matrices high condition numbers. underlying idea if

a*b_1 = c 

and we're solving problem (because using approximate numbers when use computers)

(a + matrix error)*b_2 = (c + vector error) 

how close b_1 , b_2 function of matrix , vector errors? when has small condition number b_1 , b_2 close. when has large condition number b_1 , b_2 not close.

there informative piece of analysis on algorithm. @ each iteration, after you've found b, find use matlab find condition number of it.

cond(b) 

you see number climb rapidly. indicates every time iterate algorithm, should trust result b less , less.

problems crop time in numerical mathematics. if you'll working numerical algorithms should take time familiarize role of condition numbers in field , preconditioning techniques mentioned above. preferred text "numerical linear algebra" lloyd trefethen, text on numerical algebra should address of these issues.

best of luck, andrew


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -