| 38 | typedef SparseMatrix<Scalar,RowMajorBit|UpperTriangular> EigenSparseTriMatrixRow; |
| 39 | |
| 40 | void fillMatrix(float density, int rows, int cols, EigenSparseTriMatrix& dst) |
| 41 | { |
| 42 | dst.startFill(rows*cols*density); |
| 43 | for(int j = 0; j < cols; j++) |
| 44 | { |
| 45 | for(int i = 0; i < j; i++) |
| 46 | { |
| 47 | Scalar v = (internal::random<float>(0,1) < density) ? internal::random<Scalar>() : 0; |
| 48 | if (v!=0) |
| 49 | dst.fill(i,j) = v; |
| 50 | } |
| 51 | dst.fill(j,j) = internal::random<Scalar>(); |
| 52 | } |
| 53 | dst.endFill(); |
| 54 | } |
| 55 | |
| 56 | int main(int argc, char *argv[]) |
| 57 | { |