[英]clarify some things about culasparse
Checking this example (API example at the end), I want to ask a few questions. 检查这个例子(最后的API例子),我想问几个问题。
1) In the example we are supplying matrix a with non zero elements.What is the real size of the matrix though?And these are the elements of the matrix or the positions that contain non zero elements? 1)在这个例子中,我们提供了非零元素的矩阵a。虽然矩阵的实际大小是多少?这些是矩阵的元素还是包含非零元素的位置?
2) Can I use at the calculations (use in a function like culaSparseSetDcooData) a matrix A which will contain zero and non zero elements? 2)我可以在计算中使用(在像culaSparseSetDcooData这样的函数中使用)矩阵A,它将包含零和非零元素吗? If I want to create a sample matrix just to test ,should I have to create a matrix with zero elements,then fill it with some elements and then?
如果我想创建一个样本矩阵来测试,我是否应该创建一个零元素的矩阵,然后用一些元素填充它然后呢?
Regarding 1) Interestingly, the size of the matrix in COO format is not explicitly specified: It consists of coordinates of the non-zero elements of the matrix. 关于1)有趣的是,COO格式的矩阵大小没有明确规定:它由矩阵的非零元素的坐标组成。 If you have a COO matrix with 1 non-zero element, then this could be
如果你有一个含有1个非零元素的COO矩阵,那么这可能是
double a[1] = { 1.0 };
int colInd[1] = { 10 };
int rowInd[1] = { 20 };
and (as you can tell from the row/column indices) describe elements of a matrix that has at least size 11*21, or it could be 和(从行/列索引可以看出)描述至少大小为11 * 21的矩阵元素,或者它可能是
double a[1] = { 1.0 };
int colInd[1] = { 1000 };
int rowInd[1] = { 2000 };
and describe elements of a matrix that has at least size 1001*2001 并描述至少具有1001 * 2001大小的矩阵的元素
However, in this example, it seems like this is a quadratic matrix, and n=8
seems to be the size. 然而,在这个例子中,似乎这是一个二次矩阵,
n=8
似乎是大小。 (Unfortunately, there seems to be no detailed documentation of the culaSparseSetDcooData
function...) (不幸的是,似乎没有
culaSparseSetDcooData
函数的详细文档...)
Regarding 2) This is not entirely clear. 关于2)这不完全清楚。 If your question is whether the "non-zero" values may (in reality) have a value of
0.0
, then I can say: Yes, this should be allowed. 如果您的问题是,是否“非零”值可能 (实际上)具有值
0.0
,那么我可以说:是的,这应该被允许。 However, the example that you referred to already shows how to create a simple test matrix. 但是,您引用的示例已经显示了如何创建简单的测试矩阵。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.