Warning: This API is deprecated and will be removed in a future
version of TensorFlow after
the replacement is stable.
SparseMatrixOrderingAMD
Stay organized with collections
Save and categorize content based on your preferences.
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`.
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
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.
Factory method to create a class wrapping a new SparseMatrixOrderingAMD operation.
Parameters
scope |
current scope |
input |
A `CSRSparseMatrix`. |
Returns
- a new instance of SparseMatrixOrderingAMD
public
Output<Integer>
output
()
The Approximate Minimum Degree (AMD) ordering of `input`.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-02-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-02-12 UTC."],[],[],null,["# SparseMatrixOrderingAMD\n\npublic final class **SparseMatrixOrderingAMD** \nComputes the Approximate Minimum Degree (AMD) ordering of \\`input\\`.\n\n\nComputes the Approximate Minimum Degree (AMD) ordering for a sparse matrix.\n\n\nThe returned permutation may be used to permute the rows and columns of the\ngiven sparse matrix. This typically results in permuted sparse matrix's sparse\nCholesky (or other decompositions) in having fewer zero fill-in compared to\ndecomposition of the original matrix.\n\n\nThe input sparse matrix may have rank 2 or rank 3. The output Tensor,\nrepresenting would then have rank 1 or 2 respectively, with the same batch\nshape as the input.\n\n\nEach component of the input sparse matrix must represent a square symmetric\nmatrix; only the lower triangular part of the matrix is read. The values of the\nsparse matrix does not affect the returned permutation, only the sparsity\npattern of the sparse matrix is used. Hence, a single AMD ordering may be\nreused for the Cholesky decompositions of sparse matrices with the same sparsity\npattern but with possibly different values.\n\n\nEach batch component of the output permutation represents a permutation of \\`N\\`\nelements, where the input sparse matrix components each have \\`N\\` rows. That is,\nthe component contains each of the integers \\`{0, .. N-1}\\` exactly once. The\n\\`i\\`th element represents the row index that the \\`i\\`th row maps to.\n\n\nUsage example: \n\n from tensorflow.python.ops.linalg.sparse import sparse_csr_matrix_ops\n \n a_indices = np.array([[0, 0], [1, 1], [2, 1], [2, 2], [3, 3]])\n a_values = np.array([1.0, 2.0, 1.0, 3.0, 4.0], np.float32)\n a_dense_shape = [4, 4]\n \n with tf.Session() as sess:\n # Define (COO format) SparseTensor over Numpy array.\n a_st = tf.sparse.SparseTensor(a_indices, a_values, a_dense_shape)\n \n # Convert SparseTensors to CSR SparseMatrix.\n a_sm = sparse_csr_matrix_ops.sparse_tensor_to_csr_sparse_matrix(\n a_st.indices, a_st.values, a_st.dense_shape)\n \n # Obtain the AMD Ordering for the CSR SparseMatrix.\n ordering_amd = sparse_csr_matrix_ops.sparse_matrix_ordering_amd(sparse_matrix)\n \n ordering_amd_value = sess.run(ordering_amd)\n \n\\`ordering_amd_value\\` stores the AMD ordering: \\`\\[1 2 3 0\\]\\`.\n\n\ninput: A \\`CSRSparseMatrix\\`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Methods\n\n|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cInteger\\\u003e | [asOutput](/api_docs/java/org/tensorflow/op/core/SparseMatrixOrderingAMD#asOutput())() Returns the symbolic handle of a tensor. |\n| static [SparseMatrixOrderingAMD](/api_docs/java/org/tensorflow/op/core/SparseMatrixOrderingAMD) | [create](/api_docs/java/org/tensorflow/op/core/SparseMatrixOrderingAMD#create(org.tensorflow.op.Scope,%20org.tensorflow.Operand\u003c?\u003e))([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003c?\\\u003e input) Factory method to create a class wrapping a new SparseMatrixOrderingAMD operation. |\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cInteger\\\u003e | [output](/api_docs/java/org/tensorflow/op/core/SparseMatrixOrderingAMD#output())() The Approximate Minimum Degree (AMD) ordering of \\`input\\`. |\n\n### Inherited Methods\n\nFrom class [org.tensorflow.op.PrimitiveOp](/api_docs/java/org/tensorflow/op/PrimitiveOp) \n\n|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| final boolean | [equals](/api_docs/java/org/tensorflow/op/PrimitiveOp#equals(java.lang.Object))(Object obj) |\n| final int | [hashCode](/api_docs/java/org/tensorflow/op/PrimitiveOp#hashCode())() |\n| [Operation](/api_docs/java/org/tensorflow/Operation) | [op](/api_docs/java/org/tensorflow/op/PrimitiveOp#op())() Returns the underlying [Operation](/api_docs/java/org/tensorflow/Operation) |\n| final String | [toString](/api_docs/java/org/tensorflow/op/PrimitiveOp#toString())() |\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [org.tensorflow.Operand](/api_docs/java/org/tensorflow/Operand) \n\n|--------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| abstract [Output](/api_docs/java/org/tensorflow/Output)\\\u003cInteger\\\u003e | [asOutput](/api_docs/java/org/tensorflow/Operand#asOutput())() Returns the symbolic handle of a tensor. |\n\nPublic Methods\n--------------\n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cInteger\\\u003e\n**asOutput**\n()\n\nReturns the symbolic handle of a tensor.\n\nInputs to TensorFlow operations are outputs of another TensorFlow operation. This method is\nused to obtain a symbolic handle that represents the computation of the input.\n\n\u003cbr /\u003e\n\n#### public static [SparseMatrixOrderingAMD](/api_docs/java/org/tensorflow/op/core/SparseMatrixOrderingAMD)\n**create**\n([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003c?\\\u003e input)\n\nFactory method to create a class wrapping a new SparseMatrixOrderingAMD operation. \n\n##### Parameters\n\n| scope | current scope |\n| input | A \\`CSRSparseMatrix\\`. |\n|-------|------------------------|\n\n##### Returns\n\n- a new instance of SparseMatrixOrderingAMD \n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cInteger\\\u003e\n**output**\n()\n\nThe Approximate Minimum Degree (AMD) ordering of \\`input\\`."]]