@ Override public INDArray toDense ( ) { // TODO support view conversion INDArray result = Nd4j . zeros ( shape ( ) ) ; switch ( data ( ) . dataType ( ) ) { case DOUBLE : for ( int i = 0 ; i < length ; i ++ ) { int [ ] idx = getUnderlyingIndicesOf ( i ) . asInt ( ) ; double value = values . getDouble ( i ) ; result . putScalar ( idx , value ) ; } break ; case FLOAT : for ( int i = 0 ; i < length ; i ++ ) { int [ ] idx = getUnderlyingIndicesOf ( i ) . asInt ( ) ; float value = values . getFloat ( i ) ; result . putScalar ( idx , value ) ; } break ; default : throw new UnsupportedOperationException ( ) ; } return result ; }
Converts the sparse ndarray into a dense one