Uses 652K of libraries. Click here for Pure Java version (7933L/44K).
1 | !include once #1035331 // EJML Include (Matrix library) |
2 | |
3 | static double[] ejmlMatrixToVector(DMatrixRMaj matrix) { |
4 | int w = matrix.getNumCols(), h = matrix.getNumRows(); |
5 | if (w == 1) { |
6 | double[] vector = new double[h]; |
7 | for i to h: |
8 | vector[i] = matrix.get(i, 0); |
9 | ret vector; |
10 | } else if (h == 1) { |
11 | double[] vector = new double[w]; |
12 | for i to w: |
13 | vector[i] = matrix.get(0, i); |
14 | ret vector; |
15 | } else |
16 | fail("Matrix is not a vector: " + w + "*" + h); |
17 | } |
Began life as a copy of #1035364
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035366 |
Snippet name: | ejmlMatrixToVector |
Eternal ID of this version: | #1035366/1 |
Text MD5: | 21fd961da1d9f0974d2363a20ecc403c |
Transpilation MD5: | 9494b475cd94ff7d1c8eb373765370ce |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-05-02 13:19:45 |
Source code size: | 497 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 126 / 178 |
Referenced in: | [show references] |