Bandwidth() public method

Computes the bandwidth of an adjacency matrix.
public Bandwidth ( ) : int
return int
Ejemplo n.º 1
0
        /// <summary>
        /// Gets the permutation vector for the Reverse Cuthill-McKee numbering.
        /// </summary>
        /// <param name="mesh">The mesh.</param>
        /// <returns>Permutation vector.</returns>
        public int[] Renumber(AdjacencyMatrix matrix)
        {
            this.matrix = matrix;

            int bandwidth1 = matrix.Bandwidth();

            var pcol = matrix.ColumnPointers;

            // Adjust column pointers (1-based indexing).
            Shift(pcol, true);

            // TODO: Make RCM work with 0-based matrix.

            // Compute the RCM permutation.
            int[] perm = GenerateRcm();

            int[] perm_inv = PermInverse(perm);

            int bandwidth2 = PermBandwidth(perm, perm_inv);

            if (Log.Verbose)
            {
                Log.Instance.Info(String.Format("Reverse Cuthill-McKee (Bandwidth: {0} > {1})",
                    bandwidth1, bandwidth2));
            }

            // Adjust column pointers (0-based indexing).
            Shift(pcol, false);

            return perm_inv;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the permutation vector for the Reverse Cuthill-McKee numbering.
        /// </summary>
        /// <param name="mesh">The mesh.</param>
        /// <returns>Permutation vector.</returns>
        public int[] Renumber(AdjacencyMatrix matrix)
        {
            this.matrix = matrix;

            int bandwidth1 = matrix.Bandwidth();

            var pcol = matrix.ColumnPointers;

            // Adjust column pointers (1-based indexing).
            Shift(pcol, true);

            // TODO: Make RCM work with 0-based matrix.

            // Compute the RCM permutation.
            int[] perm = GenerateRcm();

            int[] perm_inv = PermInverse(perm);

            int bandwidth2 = PermBandwidth(perm, perm_inv);

            if (Log.Verbose)
            {
                Log.Instance.Info(String.Format("Reverse Cuthill-McKee (Bandwidth: {0} > {1})",
                                                bandwidth1, bandwidth2));
            }

            // Adjust column pointers (0-based indexing).
            Shift(pcol, false);

            return(perm_inv);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the permutation vector for the Reverse Cuthill-McKee numbering.
        /// </summary>
        /// <param name="mesh">The mesh.</param>
        /// <returns>Permutation vector.</returns>
        public int[] Renumber(Mesh mesh)
        {
            int bandwidth1, bandwidth2;

            this.node_num = mesh.vertices.Count;

            // Algorithm needs linear numbering of the nodes.
            mesh.Renumber(NodeNumbering.Linear);

            // Set up the adj_row adjacency pointer array.
            matrix = new AdjacencyMatrix(mesh);

            bandwidth1 = matrix.Bandwidth();

            // Compute the RCM permutation.
            int[] perm = GenerateRcm();

            int[] perm_inv = PermInverse(node_num, perm);

            bandwidth2 = PermBandwidth(perm, perm_inv);

            if (Behavior.Verbose)
            {
                SimpleLog.Instance.Info(String.Format("Reverse Cuthill-McKee (Bandwidth: {0} > {1})",
                                                      bandwidth1, bandwidth2));
            }

            return(perm_inv);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the permutation vector for the Reverse Cuthill-McKee numbering.
        /// </summary>
        /// <param name="mesh">The mesh.</param>
        /// <returns>Permutation vector.</returns>
        public int[] Renumber(Mesh mesh)
        {
            int bandwidth1, bandwidth2;

            this.node_num = mesh.vertices.Count;

            // Algorithm needs linear numbering of the nodes.
            mesh.Renumber(NodeNumbering.Linear);

            // Set up the adj_row adjacency pointer array.
            matrix = new AdjacencyMatrix(mesh);

            bandwidth1 = matrix.Bandwidth();

            // Compute the RCM permutation.
            int[] perm = GenerateRcm();

            int[] perm_inv = PermInverse(node_num, perm);

            bandwidth2 = PermBandwidth(perm, perm_inv);

            if (Behavior.Verbose)
            {
                SimpleLog.Instance.Info(String.Format("Reverse Cuthill-McKee (Bandwidth: {0} > {1})",
                    bandwidth1, bandwidth2));
            }

            return perm_inv;
        }