@ Override public INDArray linspace ( int lower , int upper , int num ) { double [ ] data = new double [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { double t = ( double ) i / ( num - 1 ) ; data [ i ] = lower * ( 1 - t ) + t * upper ; } //edge case for scalars INDArray ret = Nd4j . create ( data . length ) ; if ( ret . isScalar ( ) ) return ret ; for ( int i = 0 ; i < ret . length ( ) ; i ++ ) ret . putScalar ( i , data [ i ] ) ; return ret ; }
Generate a linearly spaced vector