<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、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # Kotlin 程序:查找矩陣的轉置 > 原文: [https://www.programiz.com/kotlin-programming/examples/transpose-matrix](https://www.programiz.com/kotlin-programming/examples/transpose-matrix) #### 在此程序中,您將學習在 Kotlin 中查找并打印給定矩陣的轉置。 矩陣的轉置是將行交換為列的過程。 對于 2x3 矩陣, ```kt Matrix a11 a12 a13 a21 a22 a23 Transposed Matrix a11 a21 a12 a22 a13 a23 ``` ## 示例:查找矩陣轉置的程序 ```kt fun main(args: Array<String>) { val row = 2 val column = 3 val matrix = arrayOf(intArrayOf(2, 3, 4), intArrayOf(5, 6, 4)) // Display current matrix display(matrix) // Transpose the matrix val transpose = Array(column) { IntArray(row) } for (i in 0..row - 1) { for (j in 0..column - 1) { transpose[j][i] = matrix[i][j] } } // Display transposed matrix display(transpose) } fun display(matrix: Array<intarray>) { println("The matrix is: ") for (row in matrix) { for (column in row) { print("$column ") } println() } }</intarray> ``` 運行該程序時,輸出為: ```kt The matrix is: 2 3 4 5 6 4 The matrix is: 2 5 3 6 4 4 ``` 在上述程序中,`display()`函數僅用于將矩陣的內容打印到屏幕上。 在此,給定矩陣的格式為`2x3`,即`row = 2`和`column = 3`。 對于轉置矩陣,我們將轉置順序更改為`3x2`,即`row = 3`和`column = 2`。 因此,我們有`transpose = int[column][row]` 矩陣的轉置是通過簡單地將列交換為行來計算的: ```kt transpose[j][i] = matrix[i][j] ``` 以下是等效的 Java 代碼:[查找矩陣轉置的 Java 程序](/java-programming/examples/transpose-matrix "Java Program to Find transpose of a matrix")
                  <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>

                              哎呀哎呀视频在线观看