Message Boards Message Boards

0
|
2293 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

about LUdecomposition of a sparse array

Posted 10 years ago

hi, i wan't to use LUdecomposition for a matrix a but don 't give me the good result h = {{2, 4, -2}, {4, 9, -3}, {-2, -3, 7}}

{lu, p, c} = LUDecomposition[h]

i want to take upper element and lower element ,for that i use

lu SparseArray[{i, j} /; j >= i -> 1, {2, 2}];

but no response, please give me the good solution

thank you

POSTED BY: ayour aziz

You want

SparseArray[{i_, j_} /; j >= i -> 1, {3, 3}]

Note that there is the {i,j} pattern as well as the {3,3}

This then gives you, with

sa = SparseArray[{i_, j_} /; j >= i -> 1, {3, 3}];

then

lu sa

is

{{2, 4, -2}, {0, 1, 1}, {0, 0, 4}}
POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract