| 56 | } |
| 57 | return tmp; |
| 58 | }; |
| 59 | const mat getmat ( Setting& S , int ncols) const { |
| 60 | CHECK_UITYPE ( S,TypeArray ); |
| 61 | mat tmp; |
| 62 | int nrows=S.getLength()/ncols; |
| 63 | int r=0,c=0; |
| 64 | tmp.set_size ( nrows, ncols ); |
| 65 | // Build matrix row-wise |
| 66 | for ( int i=0;i<S.getLength();i++ ) { |
| 67 | switch ( S[i].getType() ) { |
| 68 | case Setting::TypeFloat : |
| 69 | tmp(r,c)=double ( S[i] );break; |
| 70 | case Setting::TypeInt : |
| 71 | tmp(r,c)=int ( S[i] );break; |
| 72 | case Setting::TypeBoolean : |
| 73 | tmp(r,c)=bool ( S[i] );break; |
| 74 | default: it_error ( "libconfig error?" ); |
| 75 | } |
| 76 | c++; if (c==ncols) {c=0;r++;} |