本文整理汇总了Java中org.bytedeco.javacpp.DoublePointer类的典型用法代码示例。如果您正苦于以下问题:Java DoublePointer类的具体用法?Java DoublePointer怎么用?Java DoublePointer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DoublePointer类属于org.bytedeco.javacpp包,在下文中一共展示了DoublePointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dsyrk
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dsyrk(char Order, char Uplo, char Trans, int N, int K, double alpha, INDArray A, int lda,
double beta, INDArray C, int ldc) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE syrk called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(C, A);
CublasPointer aPointer = new CublasPointer(A, ctx);
CublasPointer cPointer = new CublasPointer(C, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDsyrk_v2(new cublasContext(handle), convertUplo(Uplo), Trans, N, K, new DoublePointer(alpha),
(DoublePointer) aPointer.getDevicePointer(), lda, new DoublePointer(beta),
(DoublePointer) cPointer.getDevicePointer(), ldc);
}
allocator.registerAction(ctx, C, A);
OpExecutionerUtil.checkForAny(C);
}
示例2: dtrsm
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dtrsm(char Order, char Side, char Uplo, char TransA, char Diag, int M, int N, double alpha,
INDArray A, int lda, INDArray B, int ldb) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE trsm called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(B, A);
CublasPointer aPointer = new CublasPointer(A, ctx);
CublasPointer bPointer = new CublasPointer(B, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDtrsm_v2(new cublasContext(handle), convertSideMode(Side), convertUplo(Uplo),
convertTranspose(TransA), convertDiag(Diag), M, N, new DoublePointer(alpha),
(DoublePointer) aPointer.getDevicePointer(), lda,
(DoublePointer) bPointer.getDevicePointer(), ldb);
}
allocator.registerAction(ctx, B, A);
OpExecutionerUtil.checkForAny(B);
}
示例3: idamax
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected int idamax(int N, INDArray X, int incX) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE imax called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(null, X);
int ret2;
CublasPointer xCPointer = new CublasPointer(X, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
IntPointer resultPointer = new IntPointer(new int[] {0});
cublasIdamax_v2(new cublasContext(handle), N, (DoublePointer) xCPointer.getDevicePointer(), incX,
resultPointer);
ret2 = resultPointer.get();
}
allocator.registerAction(ctx, null, X);
return ret2 - 1;
}
示例4: dswap
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dswap(int N, INDArray X, int incX, INDArray Y, int incY) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE swap called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(Y, X);
CublasPointer xCPointer = new CublasPointer(X, ctx);
CublasPointer yCPointer = new CublasPointer(Y, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDswap_v2(new cublasContext(handle), N, (DoublePointer) xCPointer.getDevicePointer(), incX,
(DoublePointer) yCPointer.getDevicePointer(), incY);
}
allocator.registerAction(ctx, Y, X);
OpExecutionerUtil.checkForAny(Y);
}
示例5: dcopy
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dcopy(int N, INDArray X, int incX, INDArray Y, int incY) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE copy called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(Y, X);
CublasPointer xCPointer = new CublasPointer(X, ctx);
CublasPointer yCPointer = new CublasPointer(Y, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDcopy_v2(new cublasContext(handle), N, (DoublePointer) xCPointer.getDevicePointer(), incX,
(DoublePointer) yCPointer.getDevicePointer(), incY);
}
allocator.registerAction(ctx, Y, X);
OpExecutionerUtil.checkForAny(Y);
}
示例6: dscal
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dscal(int N, double alpha, INDArray X, int incX) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE scal called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(X);
CublasPointer xCPointer = new CublasPointer(X, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDscal_v2(new cublasContext(handle), N, new DoublePointer(alpha),
(DoublePointer) xCPointer.getDevicePointer(), incX);
}
allocator.registerAction(ctx, X);
OpExecutionerUtil.checkForAny(X);
}
示例7: sortCooIndices
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
public INDArray sortCooIndices(INDArray x) {
if(x.getFormat() != SparseFormat.COO){
throw new UnsupportedOperationException("Not a COO ndarray");
}
BaseSparseNDArrayCOO array = (BaseSparseNDArrayCOO) x;
DataBuffer val = array.getValues();
DataBuffer idx = array.getIndices();
long length = val.length();
int rank = array.underlyingRank();
switch(val.dataType()){
case FLOAT:
NativeOpsHolder.getInstance().getDeviceNativeOps().sortCooIndicesFloat(null, (IntPointer) idx.addressPointer(), (FloatPointer) val.addressPointer(), length, rank);
break;
case DOUBLE:
NativeOpsHolder.getInstance().getDeviceNativeOps().sortCooIndicesDouble(null, (IntPointer) idx.addressPointer(), (DoublePointer) val.addressPointer(), length, rank);
break;
default:
throw new UnsupportedOperationException("Unknown datatype " + x.data().dataType());
}
return array;
}
示例8: dsyev
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
public int dsyev( char jobz, char uplo, int N, INDArray A, INDArray R ) {
DoublePointer dp = new DoublePointer(1) ;
int status = LAPACKE_dsyev_work( getColumnOrder(A), (byte)jobz, (byte)uplo,
N, (DoublePointer)A.data().addressPointer(), getLda(A),
(DoublePointer)R.data().addressPointer(), dp, -1 ) ;
if( status == 0 ) {
int lwork = (int)dp.get() ;
INDArray work = Nd4j.createArrayFromShapeBuffer(Nd4j.getDataBufferFactory().createDouble(lwork),
Nd4j.getShapeInfoProvider().createShapeInformation(new int[] {1, lwork}).getFirst());
status = LAPACKE_dsyev( getColumnOrder(A), (byte)jobz, (byte)uplo, N,
(DoublePointer)A.data().addressPointer(), getLda(A),
(DoublePointer)work.data().addressPointer() ) ;
if( status == 0 ) {
R.assign( work.get( NDArrayIndex.interval(0,N) ) ) ;
}
}
return status ;
}
示例9: getMaxPosition
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
/**
* Obtain max values and bin number from a histogram object.
*/
public static HistogramPosition getMaxPosition(opencv_core.Mat histogram) {
DoublePointer minVal = new DoublePointer(1);
DoublePointer maxVal = new DoublePointer(1);
opencv_core.Point minLoc = new opencv_core.Point(1);
opencv_core.Point maxLoc = new opencv_core.Point(1);
opencv_core.minMaxLoc(histogram, minVal, maxVal, minLoc, maxLoc, null);
return new HistogramPosition(maxLoc.y(), maxVal.get(0));
}
示例10: execSplit2D
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
static void execSplit2D(int width, int height, double[] inR, double[] outR, double[] outI){
assertArraySize(width*height, inR,
()->"Specified input (real) array does not macth specified size. Array length:"
+inR.length + " Size:" + width*height + "=("+width+"*"+height+")");
assertArraySize(width*height, outR,
()->"Specified output (real) array does not macth specified size. Array length:"
+outR.length + " Size:" + width*height + "=("+width+"*"+height+")");
assertArraySize(width*height, outI,
()->"Specified output (imaginary) array does not macth specified size. Array length:"
+outI.length + " Size:" + width*height + "=("+width+"*"+height+")");
try(
fftw_iodim_do_not_use_me array = new fftw_iodim_do_not_use_me(3);
fftw_iodim dims = new fftw_iodim(array);
fftw_iodim_do_not_use_me d0 = new fftw_iodim_do_not_use_me();
fftw_iodim_do_not_use_me d1 = new fftw_iodim_do_not_use_me();
fftw_iodim_do_not_use_me d2 = new fftw_iodim_do_not_use_me();
DoublePointer iR = new DoublePointer(width*height);
DoublePointer oR = new DoublePointer(width*height);
DoublePointer oI = new DoublePointer(width*height);
){
d0.n(width).is(1).os(1);
d1.n(height).is(width).os(width);
d2.n(1).is(width*height).os(width*height);
array.position(0).put(d0).position(1).put(d1).position(2).put(d2);
fftw_plan plan = fftw3.fftw_plan_guru_split_dft_r2c(
3, dims,
0, null,
iR, oR, oI,
(int)fftw3.FFTW_ESTIMATE);
iR.put(inR);
fftw3.fftw_execute_split_dft_r2c(plan, iR, oR, oI);
oR.get(outR);
oI.get(outI);
fftw3.fftw_destroy_plan(plan);
}
}
示例11: dgemv
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dgemv(char order, char TransA, int M, int N, double alpha, INDArray A, int lda, INDArray X, int incX,
double beta, INDArray Y, int incY) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE gemv called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(Y, A, X);
CublasPointer cAPointer = new CublasPointer(A, ctx);
CublasPointer cBPointer = new CublasPointer(X, ctx);
CublasPointer cCPointer = new CublasPointer(Y, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDgemv_v2(new cublasContext(handle), convertTranspose(TransA), M, N, new DoublePointer(alpha),
(DoublePointer) cAPointer.getDevicePointer(), lda,
(DoublePointer) cBPointer.getDevicePointer(), incX, new DoublePointer(beta),
(DoublePointer) cCPointer.getDevicePointer(), incY);
}
allocator.registerAction(ctx, Y, A, X);
OpExecutionerUtil.checkForAny(Y);
}
示例12: dgemm
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dgemm(char Order, char TransA, char TransB, int M, int N, int K, double alpha, INDArray A, int lda,
INDArray B, int ldb, double beta, INDArray C, int ldc) {
//A = Shape.toOffsetZero(A);
//B = Shape.toOffsetZero(B);
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE gemm called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(C, A, B);
DataTypeValidation.assertDouble(A, B, C);
CublasPointer cAPointer = new CublasPointer(A, ctx);
CublasPointer cBPointer = new CublasPointer(B, ctx);
CublasPointer cCPointer = new CublasPointer(C, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDgemm_v2(new cublasContext(handle), convertTranspose(TransA), convertTranspose(TransB), M, N, K,
new DoublePointer(alpha), (DoublePointer) cAPointer.getDevicePointer(), lda,
(DoublePointer) cBPointer.getDevicePointer(), ldb, new DoublePointer(beta),
(DoublePointer) cCPointer.getDevicePointer(), ldc);
}
allocator.registerAction(ctx, C, A, B);
OpExecutionerUtil.checkForAny(C);
}
示例13: dsymm
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dsymm(char Order, char Side, char Uplo, int M, int N, double alpha, INDArray A, int lda, INDArray B,
int ldb, double beta, INDArray C, int ldc) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE symm called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(C, A, B);
CublasPointer aPointer = new CublasPointer(A, ctx);
CublasPointer bPointer = new CublasPointer(B, ctx);
CublasPointer cPointer = new CublasPointer(C, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDsymm_v2(new cublasContext(handle), convertSideMode(Side), convertUplo(Uplo), M, N,
new DoublePointer(alpha), (DoublePointer) aPointer.getDevicePointer(), lda,
(DoublePointer) bPointer.getDevicePointer(), ldb, new DoublePointer(beta),
(DoublePointer) cPointer.getDevicePointer(), ldc);
}
allocator.registerAction(ctx, C, A, B);
OpExecutionerUtil.checkForAny(C);
}
示例14: dsyr2k
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dsyr2k(char Order, char Uplo, char Trans, int N, int K, double alpha, INDArray A, int lda,
INDArray B, int ldb, double beta, INDArray C, int ldc) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE syr2k called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(C, A, B);
CublasPointer aPointer = new CublasPointer(A, ctx);
CublasPointer bPointer = new CublasPointer(B, ctx);
CublasPointer cPointer = new CublasPointer(C, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDsyr2k_v2(new cublasContext(handle), convertUplo(Uplo), Trans, N, K, new DoublePointer(alpha),
(DoublePointer) aPointer.getDevicePointer(), lda,
(DoublePointer) bPointer.getDevicePointer(), ldb, new DoublePointer(beta),
(DoublePointer) cPointer.getDevicePointer(), ldc);
}
allocator.registerAction(ctx, C, A, B);
OpExecutionerUtil.checkForAny(C);
}
示例15: dtrmm
import org.bytedeco.javacpp.DoublePointer; //导入依赖的package包/类
@Override
protected void dtrmm(char Order, char Side, char Uplo, char TransA, char Diag, int M, int N, double alpha,
INDArray A, int lda, INDArray B, int ldb) {
if (Nd4j.dataType() != DataBuffer.Type.DOUBLE)
logger.warn("DOUBLE trmm called");
Nd4j.getExecutioner().push();
CudaContext ctx = allocator.getFlowController().prepareAction(B, A);
CublasPointer aPointer = new CublasPointer(A, ctx);
CublasPointer bPointer = new CublasPointer(B, ctx);
cublasHandle_t handle = ctx.getHandle();
synchronized (handle) {
cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getOldStream()));
cublasDtrmm_v2(new cublasContext(handle), convertSideMode(Side), convertUplo(Uplo),
convertTranspose(TransA), convertDiag(Diag), M, N, new DoublePointer(alpha),
(DoublePointer) aPointer.getDevicePointer(), lda,
(DoublePointer) bPointer.getDevicePointer(), ldb,
(DoublePointer) bPointer.getDevicePointer(), ldb);
}
allocator.registerAction(ctx, B, A);
OpExecutionerUtil.checkForAny(B);
}