ucar.ma2.Index.precalc()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中ucar.ma2.Index.precalc()方法的一些代码示例,展示了Index.precalc()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Index.precalc()方法的具体详情如下:
包路径:ucar.ma2.Index
类名称:Index
方法名:precalc

Index.precalc介绍

[英]subclass specialization/optimization calculations
[中]子类专门化/优化计算

代码示例

代码示例来源:origin: edu.ucar/netcdf

private IteratorImpl(Array maa) {
 this.maa = maa;
 counter = (Index) Index.this.clone();  // could be subtype of Index
 if (rank > 0)
  counter.current[rank - 1] = -1;                  // avoid "if first" on every incr.
 counter.precalc();
 //System.out.println("IteratorSlow");
}

代码示例来源:origin: edu.ucar/cdm

private IteratorImpl(Array maa) {
 this.maa = maa;
 counter = (Index) Index.this.clone();  // could be subtype of Index
 if (rank > 0)
  counter.current[rank - 1] = -1;                  // avoid "if first" on every incr.
 counter.precalc();
 //System.out.println("IteratorSlow");
}

代码示例来源:origin: Unidata/thredds

private IteratorImpl(Array maa) {
 this.maa = maa;
 counter = (Index) Index.this.clone();  // could be subtype of Index
 if (rank > 0)
  counter.current[rank - 1] = -1;                  // avoid "if first" on every incr.
 counter.precalc();
 //System.out.println("IteratorSlow");
}

代码示例来源:origin: Unidata/thredds

/**
 * Create a new Index based on current one, except
 * flip the index so that it runs from shape[index]-1 to 0.
 * Leave rightmost vlen alone.
 *
 * @param index dimension to flip
 * @return new index with flipped dimension
 */
Index flip(int index) {
 if ((index < 0) || (index >= rank))
  throw new IllegalArgumentException();
 Index i = (Index) this.clone();
 if (shape[index] >= 0) { // !vlen case
  i.offset += stride[index] * (shape[index] - 1);
  i.stride[index] = -stride[index];
 }
 i.fastIterator = false;
 i.precalc(); // any subclass-specific optimizations
 return i;
}

代码示例来源:origin: edu.ucar/netcdf

/**
 * Create a new Index based on current one, except
 * flip the index so that it runs from shape[index]-1 to 0.
 *
 * @param index dimension to flip
 * @return new index with flipped dimension
 */
Index flip(int index) {
 if ((index < 0) || (index >= rank))
  throw new IllegalArgumentException();
 Index i = (Index) this.clone();
 i.offset += stride[index] * (shape[index] - 1);
 i.stride[index] = -stride[index];
 i.fastIterator = false;
 i.precalc(); // any subclass-specific optimizations
 return i;
}

代码示例来源:origin: edu.ucar/cdm

/**
 * create a new Index based on a permutation of the current indices; vlen fails.
 *
 * @param dims: the old index dim[k] becomes the new kth index.
 * @return new Index with permuted indices
 */
Index permute(int[] dims) {
 if (dims.length != shape.length)
  throw new IllegalArgumentException();
 for (int dim : dims)
  if ((dim < 0) || (dim >= rank))
   throw new IllegalArgumentException();
 boolean isPermuted = false;
 Index newIndex = (Index) this.clone();
 for (int i = 0; i < dims.length; i++) {
  newIndex.stride[i] = stride[dims[i]];
  newIndex.shape[i] = shape[dims[i]];
  //if (name != null) newIndex.name[i] = name[dims[i]];
  if (i != dims[i]) isPermuted = true;
 }
 newIndex.fastIterator = fastIterator && !isPermuted; // useful optimization
 newIndex.precalc(); // any subclass-specific optimizations
 return newIndex;
}

代码示例来源:origin: edu.ucar/netcdf

/**
 * create a new Index based on a permutation of the current indices
 *
 * @param dims: the old index dim[k] becomes the new kth index.
 * @return new Index with permuted indices
 */
Index permute(int[] dims) {
 if (dims.length != shape.length)
  throw new IllegalArgumentException();
 for (int dim : dims)
  if ((dim < 0) || (dim >= rank))
   throw new IllegalArgumentException();
 boolean isPermuted = false;
 Index newIndex = (Index) this.clone();
 for (int i = 0; i < dims.length; i++) {
  newIndex.stride[i] = stride[dims[i]];
  newIndex.shape[i] = shape[dims[i]];
  //if (name != null) newIndex.name[i] = name[dims[i]];
  if (i != dims[i]) isPermuted = true;
 }
 newIndex.fastIterator = fastIterator && !isPermuted; // useful optimization
 newIndex.precalc(); // any subclass-specific optimizations
 return newIndex;
}

代码示例来源:origin: Unidata/thredds

/**
 * create a new Index based on current one, except
 * transpose two of the indices.
 *
 * @param index1 transpose these two indices
 * @param index2 transpose these two indices
 * @return new Index with transposed indices
 */
Index transpose(int index1, int index2) {
 if ((index1 < 0) || (index1 >= rank))
  throw new IllegalArgumentException();
 if ((index2 < 0) || (index2 >= rank))
  throw new IllegalArgumentException();
 Index newIndex = (Index) this.clone();
 newIndex.stride[index1] = stride[index2];
 newIndex.stride[index2] = stride[index1];
 newIndex.shape[index1] = shape[index2];
 newIndex.shape[index2] = shape[index1];
 /* if (name != null) {
  newIndex.name[index1] = name[index2];
  newIndex.name[index2] = name[index1];
 } */
 newIndex.fastIterator = false;
 newIndex.precalc(); // any subclass-specific optimizations
 return newIndex;
}

代码示例来源:origin: Unidata/thredds

/**
 * create a new Index based on a permutation of the current indices; vlen fails.
 *
 * @param dims: the old index dim[k] becomes the new kth index.
 * @return new Index with permuted indices
 */
Index permute(int[] dims) {
 if (dims.length != shape.length)
  throw new IllegalArgumentException();
 for (int dim : dims)
  if ((dim < 0) || (dim >= rank))
   throw new IllegalArgumentException();
 boolean isPermuted = false;
 Index newIndex = (Index) this.clone();
 for (int i = 0; i < dims.length; i++) {
  newIndex.stride[i] = stride[dims[i]];
  newIndex.shape[i] = shape[dims[i]];
  //if (name != null) newIndex.name[i] = name[dims[i]];
  if (i != dims[i]) isPermuted = true;
 }
 newIndex.fastIterator = fastIterator && !isPermuted; // useful optimization
 newIndex.precalc(); // any subclass-specific optimizations
 return newIndex;
}

代码示例来源:origin: edu.ucar/cdm

/**
 * Create a new Index based on current one, except
 * flip the index so that it runs from shape[index]-1 to 0.
 * Leave rightmost vlen alone.
 *
 * @param index dimension to flip
 * @return new index with flipped dimension
 */
Index flip(int index) {
 if ((index < 0) || (index >= rank))
  throw new IllegalArgumentException();
 Index i = (Index) this.clone();
 if(shape[index] >= 0) {// !vlen case
   i.offset += stride[index] * (shape[index] - 1);
   i.stride[index] = -stride[index];
 }
  i.fastIterator = false;
 i.precalc(); // any subclass-specific optimizations
 return i;
}

代码示例来源:origin: edu.ucar/netcdf

/**
 * create a new Index based on current one, except
 * transpose two of the indices.
 *
 * @param index1 transpose these two indices
 * @param index2 transpose these two indices
 * @return new Index with transposed indices
 */
Index transpose(int index1, int index2) {
 if ((index1 < 0) || (index1 >= rank))
  throw new IllegalArgumentException();
 if ((index2 < 0) || (index2 >= rank))
  throw new IllegalArgumentException();
 Index newIndex = (Index) this.clone();
 newIndex.stride[index1] = stride[index2];
 newIndex.stride[index2] = stride[index1];
 newIndex.shape[index1] = shape[index2];
 newIndex.shape[index2] = shape[index1];
 /* if (name != null) {
  newIndex.name[index1] = name[index2];
  newIndex.name[index2] = name[index1];
 } */
 newIndex.fastIterator = false;
 newIndex.precalc(); // any subclass-specific optimizations
 return newIndex;
}

代码示例来源:origin: edu.ucar/cdm

/**
 * create a new Index based on current one, except
 * transpose two of the indices.
 *
 * @param index1 transpose these two indices
 * @param index2 transpose these two indices
 * @return new Index with transposed indices
 */
Index transpose(int index1, int index2) {
 if ((index1 < 0) || (index1 >= rank))
  throw new IllegalArgumentException();
 if ((index2 < 0) || (index2 >= rank))
  throw new IllegalArgumentException();
 Index newIndex = (Index) this.clone();
 newIndex.stride[index1] = stride[index2];
 newIndex.stride[index2] = stride[index1];
 newIndex.shape[index1] = shape[index2];
 newIndex.shape[index2] = shape[index1];
 /* if (name != null) {
  newIndex.name[index1] = name[index2];
  newIndex.name[index2] = name[index1];
 } */
 newIndex.fastIterator = false;
 newIndex.precalc(); // any subclass-specific optimizations
 return newIndex;
}

代码示例来源:origin: edu.ucar/cdm

/**
 * Create a new Index based on current one by
 * eliminating the specified dimension;
 *
 * @param dim: dimension to eliminate: must be of length one, else IllegalArgumentException
 * @return the new Index
 */
Index reduce(int dim) {
 if ((dim < 0) || (dim >= rank))
  throw new IllegalArgumentException("illegal reduce dim " + dim);
 if (shape[dim] != 1)
  throw new IllegalArgumentException("illegal reduce dim " + dim + " : length != 1");
 Index newindex = Index.factory(rank - 1);
 newindex.offset = offset;
 int count = 0;
 for (int ii = 0; ii < rank; ii++) {
  if (ii != dim) {
   newindex.shape[count] = shape[ii];
   newindex.stride[count] = stride[ii];
   //if (name != null) newindex.name[count] = name[ii];
   count++;
  }
 }
 newindex.size = computeSize(newindex.shape);
 newindex.fastIterator = fastIterator;
 newindex.precalc();         // any subclass-specific optimizations
 return newindex;
}

代码示例来源:origin: edu.ucar/netcdf

/**
 * Create a new Index based on current one by
 * eliminating the specified dimension;
 *
 * @param dim: dimension to eliminate: must be of length one, else IllegalArgumentException
 * @return the new Index
 */
Index reduce(int dim) {
 if ((dim < 0) || (dim >= rank))
  throw new IllegalArgumentException("illegal reduce dim " + dim);
 if (shape[dim] != 1)
  throw new IllegalArgumentException("illegal reduce dim " + dim + " : length != 1");
 Index newindex = Index.factory(rank - 1);
 newindex.offset = offset;
 int count = 0;
 for (int ii = 0; ii < rank; ii++) {
  if (ii != dim) {
   newindex.shape[count] = shape[ii];
   newindex.stride[count] = stride[ii];
   //if (name != null) newindex.name[count] = name[ii];
   count++;
  }
 }
 newindex.size = computeSize(newindex.shape);
 newindex.fastIterator = fastIterator;
 newindex.precalc();         // any subclass-specific optimizations
 return newindex;
}

代码示例来源:origin: Unidata/thredds

/**
 * Create a new Index based on current one by
 * eliminating the specified dimension;
 *
 * @param dim: dimension to eliminate: must be of length one, else IllegalArgumentException
 * @return the new Index
 */
Index reduce(int dim) {
 if ((dim < 0) || (dim >= rank))
  throw new IllegalArgumentException("illegal reduce dim " + dim);
 if (shape[dim] != 1)
  throw new IllegalArgumentException("illegal reduce dim " + dim + " : length != 1");
 Index newindex = Index.factory(rank - 1);
 newindex.offset = offset;
 int count = 0;
 for (int ii = 0; ii < rank; ii++) {
  if (ii != dim) {
   newindex.shape[count] = shape[ii];
   newindex.stride[count] = stride[ii];
   //if (name != null) newindex.name[count] = name[ii];
   count++;
  }
 }
 newindex.size = computeSize(newindex.shape);
 newindex.fastIterator = fastIterator;
 newindex.precalc();         // any subclass-specific optimizations
 return newindex;
}

代码示例来源:origin: edu.ucar/netcdf

newindex.precalc(); // any subclass-specific optimizations
return newindex;

代码示例来源:origin: edu.ucar/cdm

newindex.precalc(); // any subclass-specific optimizations
return newindex;

代码示例来源:origin: Unidata/thredds

newindex.precalc(); // any subclass-specific optimizations
return newindex;

代码示例来源:origin: Unidata/thredds

newindex.precalc(); // any subclass-specific optimizations
return newindex;

代码示例来源:origin: edu.ucar/netcdf

newindex.precalc(); // any subclass-specific optimizations
return newindex;

相关文章