我想用SuperLU进行矩阵反转,但我无法访问最终结果。它使用一些结构进行反演,我知道答案是在一个结构中,但我不能引用它。如何访问另一个结构中的结构内的一个元素作为指针?
B是定义为具有格式的超矩阵:基于S类型的存储器的变化的结构
typedef struct {
Stype_t Stype; /* Storage type: indicates the storage format of *Store. */
Dtype_t Dtype; /* Data type. */
Mtype_t Mtype; /* Mathematical type */
int nrow; /* number of rows */
int ncol; /* number of columns */
void *Store; /* pointer to the actual storage of the matrix */
} SuperMatrix;
。对B用于*商店的结构是:
typedef struct {
int lda; /* leading dimension */
void *nzval; /* array of size lda-by-ncol to represent
a dense matrix */
} DNformat;
结果B的最终结构应该是:
B = { Stype = SLU_NC; Dtype = SLU_D; Mtype = SLU_GE; nrow = 5; ncol = 5;
*Store = { lda = 12;
nzval = [ 19.00, 12.00, 12.00, 21.00, 12.00, 12.00, 21.00,
16.00, 21.00, 5.00, 21.00, 18.00 ];
}
}
现在我想的价值观出从nzval复制,但我不知道如何。
我试图做B.Store.nzval但误差“的东西请求成员`nzval”不是一个结构或联合”
而且
DNformat **g = B.Store;
int *r = *(g->nzval);
和一些其他的东西像但不知道如何解决这个问题。
非常感谢!
要回答您的其他问题;奥利拥有正确的信息。 – Suroot