<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 身份矩陣程序 > 原文: [https://www.geeksforgeeks.org/program-print-identity-matrix/](https://www.geeksforgeeks.org/program-print-identity-matrix/) **身份矩陣簡介**: **單位矩陣**的字典定義是一個方矩陣,其中主對角線或主對角線的所有元素均為 1,其他所有元素均為零。 在下圖中,每個矩陣都是一個 Identity Matrix。 ![](https://img.kancloud.cn/57/8d/578d8a65836de06ddf960df73f73a42e_578x139.png) 在線性代數中,有時將其稱為**單位矩陣**,它是一個方矩陣(大小= n x n),主對角線為 1,其他地方為零。 單位矩陣由“ **I** ”表示。 有時,U 或 E 也用于表示身份矩陣。 **單位矩陣的一個特性是,如果將其乘以單位矩陣,則矩陣將保持不變。** **示例**: ``` Input : 2 Output : 1 0 0 1 Input : 4 Output : 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 The explanation is simple. We need to make all the elements of principal or main diagonal as 1 and everything else as 0. ``` **打印身份矩陣的程序**: 邏輯很簡單。 您需要在行等于矩數組的那些位置打印 1,并將所有其他位置設為 0。 ## C++ ```cpp // C++ program to print Identity Matrix #include<bits/stdc++.h> using namespace std; int Identity(int num) { ????int row, col; ????for (row = 0; row < num; row++) ????{ ????????for (col = 0; col < num; col++) ????????{ ????????????// Checking if row is equal to column? ????????????if (row == col) ????????????????cout << 1 << " "; ????????????else ????????????????cout << 0 << " "; ????????}? ????????cout << endl; ????} ????return 0; } // Driver Code int main() { ????int size = 5; ????Identity(size); ????return 0; } // This code is contributed by shubhamsingh10 ```
                  <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>

                              哎呀哎呀视频在线观看