当前位置: 首页>>代码示例>>Java>>正文


Java DoubleBuffer.put方法代码示例

本文整理汇总了Java中java.nio.DoubleBuffer.put方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleBuffer.put方法的具体用法?Java DoubleBuffer.put怎么用?Java DoubleBuffer.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.nio.DoubleBuffer的用法示例。


在下文中一共展示了DoubleBuffer.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows, double[] scalars) {
  Random rand = new Random(System.currentTimeMillis());

  try {
    rows[0].getLock().writeLock().lock();
    double min = scalars[0];
    double max = scalars[1];
    double factor = max - min;

    DoubleBuffer data = rows[0].getData();
    int size = rows[0].size();
    for (int i = 0; i < size; i++) {
      data.put(i, factor * rand.nextDouble() + min);
    }
  } finally {
    rows[0].getLock().writeLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:20,代码来源:RandomUniform.java

示例2: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow row, double[] other) {
  try {
    row.getLock().writeLock().lock();
    DoubleBuffer data = row.getData();
    int size = row.size();
    for (int i = 0; i < size; i++) {
      data.put(i, Math.min(data.get(i), other[i]));
    }
  } finally {
    row.getLock().writeLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:14,代码来源:MinA.java

示例3: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows) {
  try {
    rows[1].getLock().writeLock().lock();
    DoubleBuffer from = rows[0].getData();
    DoubleBuffer to = rows[1].getData();
    int size = rows[0].size();
    for (int i = 0; i < size; i++) {
      to.put(i, Math.ceil(from.get(i)));
    }
  } finally {
    rows[1].getLock().writeLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:15,代码来源:Ceil.java

示例4: doubleToByteArray

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
public static byte[] doubleToByteArray(Double inDouble) {
	byte[] bArray = new byte[8];
	ByteBuffer bBuffer = ByteBuffer.wrap(bArray);
	DoubleBuffer lBuffer = bBuffer.asDoubleBuffer();
	lBuffer.put(inDouble);
	return bArray;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:8,代码来源:BinUtils.java

示例5: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows, double[] values) {
  try {
    rows[1].getLock().writeLock().lock();
    DoubleBuffer from = rows[0].getData();
    DoubleBuffer to = rows[1].getData();
    double value = values[0];
    int size = rows[0].size();
    for (int i = 0; i < size; i++) {
      to.put(i, Math.pow(from.get(i), value));
    }
  } finally {
    rows[1].getLock().writeLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:16,代码来源:Pow.java

示例6: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow row, double[] delta) {
  try {
    row.getLock().writeLock().lock();
    DoubleBuffer data = row.getData();
    int size = row.size();
    for (int i = 0; i < size; i++) {
      data.put(i, data.get(i) + delta[i]);
    }
  } finally {
    row.getLock().writeLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:14,代码来源:Increment.java

示例7: fillBuffer

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
public void fillBuffer(DoubleBuffer buffer, int timeSeriesOffset) {
    Objects.requireNonNull(buffer);
    int k = 0;
    for (int i = 0; i < stepValues.length; i++) {
        double value = stepValues[i];
        for (int j = 0; j < stepLengths[i]; j++) {
            buffer.put(timeSeriesOffset + offset + k++, value);
        }
    }
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:12,代码来源:CompressedDoubleArrayChunk.java

示例8: createDoubleBuffer

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
private static DoubleBuffer createDoubleBuffer(int size, double initialValue) {
    DoubleBuffer doubleBuffer = createDoubleBuffer(size);
    for (int i = 0; i < size; i++) {
        doubleBuffer.put(initialValue);
    }
    return doubleBuffer;
}
 
开发者ID:powsybl,项目名称:powsybl-core,代码行数:8,代码来源:TimeSeriesTable.java

示例9: createFlippedBuffer

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
public static DoubleBuffer createFlippedBuffer(double... values)
{
	DoubleBuffer buffer = createDoubleBuffer(values.length);
	buffer.put(values);
	buffer.flip();
	
	return buffer;
}
 
开发者ID:oreonengine,项目名称:Lwjgl3-Game-Engine-Programming-Series,代码行数:9,代码来源:BufferUtil.java

示例10: setTransformationMatrix

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
private void setTransformationMatrix(GeometryInfo geometryInfo, double[] transformationMatrix) {
	ByteBuffer byteBuffer = ByteBuffer.allocate(16 * 8);
	byteBuffer.order(ByteOrder.nativeOrder());
	DoubleBuffer asDoubleBuffer = byteBuffer.asDoubleBuffer();
	for (double f : transformationMatrix) {
		asDoubleBuffer.put(f);
	}
	geometryInfo.setTransformation(byteBuffer.array());
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:10,代码来源:GeometryGenerator.java

示例11: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows, double[] value) {
  for (ServerDenseDoubleRow row: rows) {
    try {
      row.getLock().writeLock().lock();
      DoubleBuffer rowData = row.getData();
      java.util.Random rand = new java.util.Random(row.getRowId());
      for (int j = 0; j < row.size(); j++) {
        rowData.put(j, rand.nextDouble());
      }
    } finally {
      row.getLock().writeLock().unlock();
    }
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:16,代码来源:Random.java

示例12: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows) {
  try {
    rows[2].getLock().writeLock().lock();
    DoubleBuffer from1 = rows[0].getData();
    DoubleBuffer from2 = rows[1].getData();
    DoubleBuffer to = rows[2].getData();
    int size = rows[0].size();
    for (int i = 0; i < size; i++) {
      to.put(i, from1.get(i) * from2.get(i));
    }
  } finally {
    rows[2].getLock().writeLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:16,代码来源:Mul.java

示例13: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow[] rows, double[] values) {
  for (ServerDenseDoubleRow row : rows) {
    int rowId = row.getRowId();
    if (rowId >= row.getStartCol() && rowId < row.getEndCol()) {
      try {
        row.getLock().writeLock().lock();
        DoubleBuffer rowData = row.getData();
        rowData.put(rowId - (int)row.getStartCol(), 1);
      } finally {
        row.getLock().writeLock().unlock();
      }
    }
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:16,代码来源:Eye.java

示例14: testGetDoubleInt

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Test
public void testGetDoubleInt() {
  ByteBuffer bb = ByteBuffer.allocate(40);
  DoubleBuffer db = bb.asDoubleBuffer();
  db.put(1.1d);
  db.put(2.2d);
  db.put(3.3d);
  db.put(4.4d);
  db.put(5.5d);
  byte[] bytes = bb.array();
  ByteSource bs = createByteSource(bytes);
  bs.position(3);
  double d = bs.getDouble(0);
  assertEquals(1.1d, d, 0.0001);
  assertEquals(3, bs.position());
  d = bs.getDouble(8);
  assertEquals(2.2d, d, 0.0001);
  assertEquals(3, bs.position());
  d = bs.getDouble(4 * 8);
  assertEquals(5.5d, d, 0.0001);
  assertEquals(3, bs.position());
  try {
    bs.getDouble((4 * 8) + 1);
    fail("expected IndexOutOfBoundsException");
  } catch (IndexOutOfBoundsException expected) {
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:28,代码来源:ByteSourceJUnitTest.java

示例15: doUpdate

import java.nio.DoubleBuffer; //导入方法依赖的package包/类
@Override
protected void doUpdate(ServerDenseDoubleRow row, double[] other) {
  try {
    row.getLock().writeLock().lock();
    DoubleBuffer data = row.getData();
    int size = row.size();
    for (int i = 0; i < size; i++) {
      data.put(i, Math.max(data.get(i), other[i]));
    }
  } finally {
    row.getLock().writeLock().unlock();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:14,代码来源:MaxA.java


注:本文中的java.nio.DoubleBuffer.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。