java - List<List<Double>> to double[][] for JAMA or other libs -


i cannot list> double[][] work on linear algebra package jama. have sort of list coordinates :

[[2.63, 11.087, -12.054],  [2.357, 13.026, -15.29],  [1.365, 16.691, -15.389],  [0.262, 18.241, -18.694]] 

and trying put these coordinates jama class double[][]. tried use method toarray, failed.

double[][] array = list.toarray(new double[list.size()][]); 

how that? or there other packages cope svd, need here, using list of lists?

guava has doubles class has toarray takes collection<? extends number> , thereby take list<double> , convert array. so...

list<list<double>> mylist; double[][] myarray = new double[mylist.size()][]; (int i=0, n<mylist.size(); i<n; i++){      myarray[i] = doubles.toarray(mylist.get(i)); } 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -