<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 對角占優矩陣 > 原文: [https://www.geeksforgeeks.org/diagonally-dominant-matrix/](https://www.geeksforgeeks.org/diagonally-dominant-matrix/) 在數學中,如果對于矩陣的每一行,一行中對角線條目的大小大于或等于,則稱方陣為 [**對角線優勢**](https://en.wikipedia.org/wiki/Diagonally_dominant_matrix#Applications_and_properties) 。 該行中所有其他(非對角線)條目的大小。 更準確地說,如果 ![](https://img.kancloud.cn/59/12/5912dcd23b8c1c2e471952e8a1e17fb6_266x98.png) 矩陣 **A** 對角占優勢,例如,由于 | a <sub>,矩陣 ![](https://img.kancloud.cn/50/46/504669dc79671d712cec0ca13f317e5e_180x96.png) 對角占優。 ] 11</sub> | ≥| a <sub>12</sub> | + | a <sub>13</sub> | 由于| +3 | ≥| -2 | + | +1 | | a <sub>22</sub> | ≥| a <sub>21</sub> | + | a <sub>23</sub> | 由于| -3 | ≥| +1 | + | +2 | | a <sub>33</sub> | ≥| a <sub>31</sub> | + | a <sub>32</sub> | 由于| +4 | ≥| -1 | + | +2 | 給定矩陣**, **n** 行和 **n** 列的**。 任務是檢查矩陣 A 是否對角占優。 **示例**: ``` Input : A = { { 3, -2, 1 }, { 1, -3, 2 }, { -1, 2, 4 } }; Output : YES Given matrix is diagonally dominant because absolute value of every diagonal element is more than sum of absolute values of corresponding row. Input : A = { { -2, 2, 1 }, { 1, 3, 2 }, { 1, -2, 0 } }; Output : NO ``` 這個想法是對行數從 i = 0 到 n-1 運行一個循環,對于每行,運行 j = 0 到 n-1 的循環,找到非對角元素的總和,即 i!= j。 并檢查對角線元素是否大于或等于和。 如果任何一行為 false,則返回 false 或打印“ No”。 否則打印“是”。 ## C++ ```cpp // CPP Program to check whether given matrix // is Diagonally Dominant Matrix. #include <bits/stdc++.h> #define N 3 using namespace std; // check the given given matrix is Diagonally // Dominant Matrix or not. bool isDDM(int m[N][N], int n) { ????// for each row ????for (int i = 0; i < n; i++) ???{???????? ????????// for each column, finding sum of each row. ????????int sum = 0; ????????for (int j = 0; j < n; j++)????????????? ????????????sum += abs(m[i][j]);???????? ????????// removing the diagonal element. ????????sum -= abs(m[i][i]); ????????// checking if diagonal element is less? ????????// than sum of non-diagonal element. ????????if (abs(m[i][i]) < sum)? ????????????return false;? ????} ????return true; } // Driven Program int main() { ????int n = 3; ????int m[N][N] = { { 3, -2, 1 }, ????????????????????{ 1, -3, 2 }, ????????????????????{ -1, 2, 4 } }; ????(isDDM(m, n)) ? (cout << "YES") : (cout << "NO"); ????return 0; } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看