igraph中矩阵大小和容量的区别
The difference between size and capacity of matrix in igraph
在igraph中,我们可以用igraph_matrix_size
得到一个矩阵的大小,我们可以用igraph_matrix_capacity
得到一个矩阵的容量,但是谁能告诉我有什么区别它们之间?
谢谢。请。
igraph_matrix_capacity
显示矩阵在不进行重定位的情况下可能具有的元素数。
documentation中有更多详细信息:
3.11.3. igraph_matrix_size — The number of elements in a matrix.
long int igraph_matrix_size(const igraph_matrix_t *m);
http://igraph.org/c/doc/ch07.html#igraph_matrix_size
相比于:
3.11.4. igraph_matrix_capacity — Returns the number of elements allocated for
a matrix.
long int igraph_matrix_capacity(const igraph_matrix_t *m);
Note that this might be different from the size of the matrix (as
queried by igraph_matrix_size()
, and specifies how many elements the
matrix can hold, without reallocation.
http://igraph.org/c/doc/ch07.html#igraph_matrix_capacity
希望这能回答您的问题。
在igraph中,我们可以用igraph_matrix_size
得到一个矩阵的大小,我们可以用igraph_matrix_capacity
得到一个矩阵的容量,但是谁能告诉我有什么区别它们之间?
谢谢。请。
igraph_matrix_capacity
显示矩阵在不进行重定位的情况下可能具有的元素数。
documentation中有更多详细信息:
3.11.3. igraph_matrix_size — The number of elements in a matrix.
long int igraph_matrix_size(const igraph_matrix_t *m);
http://igraph.org/c/doc/ch07.html#igraph_matrix_size
相比于:
3.11.4. igraph_matrix_capacity — Returns the number of elements allocated for a matrix.
long int igraph_matrix_capacity(const igraph_matrix_t *m);
Note that this might be different from the size of the matrix (as queried by
igraph_matrix_size()
, and specifies how many elements the matrix can hold, without reallocation.
http://igraph.org/c/doc/ch07.html#igraph_matrix_capacity
希望这能回答您的问题。