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

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                本地矩陣是存儲在單臺機器上的,有 integer 類型的行、列索引,double類型的值。 <br/> 密集矩陣,其輸入值按照列 column-major(列優先原則) 順序存儲在單個double 數組中。 稀疏矩陣,是其非零值按照 column-major 順序以壓縮稀疏列(CSC)格式存儲。 <br/> 本地矩陣的基類是 Matrix,并且它有兩個實現:DenseMatrix和 SparseMatrix。 ```scala sealed trait Matrix extends scala.AnyRef with scala.Serializable { class DenseMatrix(...) extends scala.AnyRef with org.apache.spark.mllib.linalg.Matrix { class SparseMatrix(...) extends scala.AnyRef with org.apache.spark.mllib.linalg.Matrix { ``` ```scala import org.apache.spark.mllib.linalg.{Matrices, Matrix} object LocalMatrix { def main(args: Array[String]): Unit = { // 創建密集矩陣((1.0, 2.0), (3.0, 4.0), (5.0, 6.0)),列優先存儲 // def dense(numRows : scala.Int, numCols : scala.Int, values : scala.Array[scala.Double]) val dm: Matrix = Matrices.dense(3, 2, Array(1.0, 3.0, 5.0, 2.0, 4.0, 6.0)) println(dm) // 1.0 2.0 // 3.0 4.0 // 5.0 6.0 // 創建稀疏矩陣 ((9.0, 0.0), (0.0, 8.0), (0.0, 6.0)) // def sparse(numRows, numCols, colPtrs, rowIndices, values) // colPtrs: 每列第一個元素在values中的索引+非0元素總數。Array(0, 1, 3), 0,1為列索引,3為values元素總數 // rowIndices: 元素所在的行 val sm: Matrix = Matrices.sparse(3, 2, Array(0, 1, 3), Array(0, 1, 2), Array(9, 8, 6)) println(sm) // 3 x 2 CSCMatrix // (0,0) 9.0 // (1,1) 8.0 // (2,1) 6.0 val sm2: Matrix = Matrices.sparse(4, 3, Array(0, 1, 2, 4), Array(0, 1, 2, 3), Array(1.0, 2.0, 3.0, 4.0)) println(sm2) // 4 x 3 CSCMatrix // (0,0) 1.0 // (1,1) 2.0 // (2,2) 3.0 // (3,2) 4.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>

                              哎呀哎呀视频在线观看