Triplet Format for Sparse Matrices
Posted kaluotee
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Triplet Format for Sparse Matrices相关的知识,希望对你有一定的参考价值。
原网站http://www.coin-or.org/Ipopt/documentation/node37.html
Triplet Format for Sparse Matrices
I
POPT
was designed for optimizing large sparse nonlinear programs. Because of problem sparsity, the required matrices (like the constraints Jacobian or Lagrangian Hessian) are not stored as dense matrices, but rather in a sparse matrix format. For the tutorials in this document, we use the triplet format. Consider the matrix
(14) |
A standard dense matrix representation would need to store floating point numbers, where many entries would be zero. In triplet format, however, only the nonzero entries are stored. The triplet format records the row number, the column number, and the value of all nonzero entries in the matrix. For the matrix above, this means storing integers for the rows, integers for the columns, and floating point numbers for the values. While this does not seem like a huge space saving over the floating point numbers stored in the dense representation, for larger matrices, the space savings are very dramatic24.
The parameter index_style in get_nlp_info tells IPOPT if you prefer to use C style indexing (0-based, i.e., starting the counting at 0) for the row and column indices or Fortran style (1-based). Tables 3 and 4 below show the triplet format for both indexing styles, using the example matrix (14).
|
|
The individual elements of the matrix can be listed in any order, and if there are multiple items for the same nonzero position, the values provided for those positions are added.
The Hessian of the Lagrangian is a symmetric matrix. In the case of a symmetric matrix, you only need to specify the lower left triangular part (or, alternatively, the upper right triangular part). For example, given the matrix,
(15) |
the triplet format is shown in Tables 5 and 6 .
|
|
Footnotes
- For an matrix, the dense representation grows with the the square of , while the sparse representation grows linearly in the number of nonzeros.
Next: The Smart Pointer Implementation: Up: Introduction to IPOPT: A Previous: Diagnostic Tags for IPOPT Contents
以上是关于Triplet Format for Sparse Matrices的主要内容,如果未能解决你的问题,请参考以下文章
Paper Reading: In Defense of the Triplet Loss for Person Re-Identification
334. Increasing Triplet Subsequence
pyg安装——ERROR: Failed building wheel for torch-sparse