本文整理汇总了Java中org.bytedeco.javacpp.Pointer.memcpy方法的典型用法代码示例。如果您正苦于以下问题:Java Pointer.memcpy方法的具体用法?Java Pointer.memcpy怎么用?Java Pointer.memcpy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bytedeco.javacpp.Pointer
的用法示例。
在下文中一共展示了Pointer.memcpy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compressPointer
import org.bytedeco.javacpp.Pointer; //导入方法依赖的package包/类
@Override
protected CompressedDataBuffer compressPointer(DataBuffer.TypeEx srcType, Pointer srcPointer, int length,
int elementSize) {
CompressionDescriptor descriptor = new CompressionDescriptor();
descriptor.setCompressionType(getCompressionType());
descriptor.setOriginalLength(length * elementSize);
descriptor.setCompressionAlgorithm(getDescriptor());
descriptor.setOriginalElementSize(elementSize);
descriptor.setCompressedLength(length * elementSize);
descriptor.setNumberOfElements(length);
BytePointer ptr = new BytePointer(length * elementSize);
// this Pointer.memcpy is used intentionally. This method operates on host memory ALWAYS
Pointer.memcpy(ptr, srcPointer, length * elementSize);
CompressedDataBuffer buffer = new CompressedDataBuffer(ptr, descriptor);
return buffer;
}
示例2: unsafeDuplication
import org.bytedeco.javacpp.Pointer; //导入方法依赖的package包/类
/**
* This method does direct array copy. Impossible to use on views or mixed orders.
*
* PLEASE NOTE: YOU SHOULD NEVER USE THIS METHOD, UNLESS YOU 100% CLEAR ABOUT IT
*
* @return
*/
@Override
public INDArray unsafeDuplication() {
if (isView())
return this.dup(this.ordering());
DataBuffer rb = Nd4j.getMemoryManager().getCurrentWorkspace() == null ? Nd4j.getDataBufferFactory().createSame(this.data, false) : Nd4j.getDataBufferFactory().createSame(this.data, false, Nd4j.getMemoryManager().getCurrentWorkspace());
INDArray ret = Nd4j.createArrayFromShapeBuffer(rb, this.shapeInfoDataBuffer());
Pointer.memcpy(ret.data().addressPointer(), this.data().addressPointer(), this.data().length() * this.data().getElementSize());
return ret;
}
示例3: dup
import org.bytedeco.javacpp.Pointer; //导入方法依赖的package包/类
@Override
public DataBuffer dup() {
Pointer nPtr = new BytePointer(compressionDescriptor.getCompressedLength());
Pointer.memcpy(nPtr, pointer, compressionDescriptor.getCompressedLength());
CompressionDescriptor nDesc = compressionDescriptor.clone();
CompressedDataBuffer nBuf = new CompressedDataBuffer(nPtr, nDesc);
return nBuf;
}
示例4: memcpy
import org.bytedeco.javacpp.Pointer; //导入方法依赖的package包/类
@Override
public void memcpy(DataBuffer dstBuffer, DataBuffer srcBuffer) {
Pointer.memcpy(dstBuffer.addressPointer(), srcBuffer.addressPointer(),
srcBuffer.length() * srcBuffer.getElementSize());
}