public SparseFloatVector(TIntFloatMap values,int dimensionality) throws IllegalArgumentException {
  if (values.size() > dimensionality) {
    throw new IllegalArgumentException("values.size() > dimensionality!");
  }
  this.indexes=new int[values.size()];
  this.values=new float[values.size()];
{
    TIntFloatIterator iter=values.iterator();
    for (int i=0; iter.hasNext(); i++) {
      iter.advance();
      this.indexes[i]=iter.key();
    }
    Arrays.sort(this.indexes);
  }
{
    for (int i=0; i < values.size(); i++) {
      this.values[i]=values.get(this.indexes[i]);
    }
  }
  this.dimensionality=dimensionality;
  final int maxdim=getMaxDim();
  if (maxdim > dimensionality) {
    throw new IllegalArgumentException("Given dimensionality " + dimensionality + " is too small w.r.t. the given values (occurring maximum: "+ maxdim+ ").");
  }
}

public SparseFloatVector ( TIntFloatMap values , int dimensionality ) throws IllegalArgumentException { if ( values . size ( ) > dimensionality ) { throw new IllegalArgumentException ( "values.size() > dimensionality!" ) ; } this . indexes = new int [ values . size ( ) ] ; this . values = new float [ values . size ( ) ] ; { TIntFloatIterator iter = values . iterator ( ) ; for ( int i = 0 ; iter . hasNext ( ) ; i ++ ) { iter . advance ( ) ; this . indexes [ i ] = iter . key ( ) ; } Arrays . sort ( this . indexes ) ; } { for ( int i = 0 ; i < values . size ( ) ; i ++ ) { this . values [ i ] = values . get ( this . indexes [ i ] ) ; } } this . dimensionality = dimensionality ; final int maxdim = getMaxDim ( ) ; if ( maxdim > dimensionality ) { throw new IllegalArgumentException ( "Given dimensionality " + dimensionality + " is too small w.r.t. the given values (occurring maximum: " + maxdim + ")." ) ; } }
create a sparsefloatvector consisting of double values according to the specified mapping of indices and values .
