Warning: This API is deprecated and will be removed in a future version of TensorFlow after the replacement is stable.

# SparseMatrixOrderingAMD

public final class SparseMatrixOrderingAMD

Computes the Approximate Minimum Degree (AMD) ordering of `input`.

Computes the Approximate Minimum Degree (AMD) ordering for a sparse matrix.

The returned permutation may be used to permute the rows and columns of the given sparse matrix. This typically results in permuted sparse matrix's sparse Cholesky (or other decompositions) in having fewer zero fill-in compared to decomposition of the original matrix.

The input sparse matrix may have rank 2 or rank 3. The output Tensor, representing would then have rank 1 or 2 respectively, with the same batch shape as the input.

Each component of the input sparse matrix must represent a square symmetric matrix; only the lower triangular part of the matrix is read. The values of the sparse matrix does not affect the returned permutation, only the sparsity pattern of the sparse matrix is used. Hence, a single AMD ordering may be reused for the Cholesky decompositions of sparse matrices with the same sparsity pattern but with possibly different values.

Each batch component of the output permutation represents a permutation of `N` elements, where the input sparse matrix components each have `N` rows. That is, the component contains each of the integers `{0, .. N-1}` exactly once. The `i`th element represents the row index that the `i`th row maps to.

Usage example:

``````from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops

a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]])
a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32)
a_dense_shape = [4, 4]

with tf.Session() as sess:
# Define (COO format) SparseTensor over Numpy array.
a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape)

# Convert SparseTensors to CSR SparseMatrix.
a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(
a_st.indices, a_st.values, a_st.dense_shape)

# Obtain the AMD Ordering for the CSR SparseMatrix.
ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix)

ordering_amd_value = sess.run(ordering_amd)
``````
`ordering_amd_value` stores the AMD ordering: `[1 2 3 0]`.

input: A `CSRSparseMatrix`.

### Public Methods

 Output asOutput() Returns the symbolic handle of a tensor. static SparseMatrixOrderingAMD create(Scope scope, Operand input) Factory method to create a class wrapping a new SparseMatrixOrderingAMD operation. Output output() The Approximate Minimum Degree (AMD) ordering of `input`.

## Public Methods

#### public Output<Integer> asOutput()

Returns the symbolic handle of a tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

#### public static SparseMatrixOrderingAMD create(Scope scope, Operand<?> input)

Factory method to create a class wrapping a new SparseMatrixOrderingAMD operation.

##### Parameters
scope current scope A `CSRSparseMatrix`.
##### Returns
• a new instance of SparseMatrixOrderingAMD

#### public Output<Integer> output()

The Approximate Minimum Degree (AMD) ordering of `input`.
{"ft_lang_label":"__label__en","ft_lang_prob":0.5740936,"math_prob":0.84269094,"size":2949,"snap":"2021-04-2021-17","text_gpt3_token_len":695,"char_repetition_ratio":0.15348047,"word_repetition_ratio":0.054320987,"special_character_ratio":0.22855206,"punctuation_ratio":0.15944882,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9965267,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-23T03:03:14Z\",\"WARC-Record-ID\":\"<urn:uuid:69c5dc4c-bb41-4f81-8dea-a84cbf3af2ea>\",\"Content-Length\":\"389539\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6306a849-c0b8-440c-9c45-ca915f4b98ef>\",\"WARC-Concurrent-To\":\"<urn:uuid:1f5c8db0-8733-4e11-b65b-2d779e76f63a>\",\"WARC-IP-Address\":\"172.217.13.67\",\"WARC-Target-URI\":\"https://tensorflow.google.cn/api_docs/java/org/tensorflow/op/core/SparseMatrixOrderingAMD\",\"WARC-Payload-Digest\":\"sha1:THF3LXCCPXVTBU4RHAEBOTSB2UKJP7TW\",\"WARC-Block-Digest\":\"sha1:FOGFNCUHZNPVW3F7GXTSN3EWJSM34REJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610703531702.36_warc_CC-MAIN-20210123001629-20210123031629-00520.warc.gz\"}"}