There is an upper triangular matrix A[5][5] stored in array B compressed by row

deedis 注册会员
2023-02-28 08:31
< div class = "md_content_show e397 data - v - 3967" = "" >

how do you know A [5] [5] has 15 non-zero number, don't understand this compression matrix storage

didadoc 注册会员
2023-02-28 08:31


dongchenxf 注册会员
2023-02-28 08:31

Based on Monster group and GPT write:
About "depending on the base address, when you need to subtract one and when you don't need" question, need to analyze on a case-by-case basis.

In general, you need to determine whether you need to adjust the base address based on how the array is defined and the memory management rules of the programming language. In some programming languages, array subscripts count from 0, while in others, array subscripts count from 1, which may affect whether you need to subtract one when calculating an address.

wuyi3320 注册会员
2023-02-28 08:31

How do I figure out 108?
For the upper triangular matrix A[5][5], the value of A[3][2] is 0, and all 0 values are stored to the last one of the compressed array. A[5][5] has a total of 15 non-zero numbers, so all zeros are in the 16th element. So the address would be 100+(16-1)*2= 130