diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/jni/JNI_RAppl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/jni/JNI_RAppl.java index c72cd68f6a7eafd2b9eb271f2fbabc115ca632b8..ac83274ac58ee01a5aa1b5297200aeb1e05fc0bb 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/jni/JNI_RAppl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/jni/JNI_RAppl.java @@ -51,6 +51,38 @@ public class JNI_RAppl implements RApplRFFI { } } + private static class JNI_DqrqtyNode extends DqrqtyNode { + @Override + @TruffleBoundary + public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qty) { + native_dqrqty(x, n, k, qraux, y, ny, qty); + } + } + + private static class JNI_DqrqyNode extends DqrqyNode { + @Override + @TruffleBoundary + public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qy) { + native_dqrqy(x, n, k, qraux, y, ny, qy); + } + } + + private static class JNI_DqrrsdNode extends DqrrsdNode { + @Override + @TruffleBoundary + public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] rsd) { + native_dqrrsd(x, n, k, qraux, y, ny, rsd); + } + } + + private static class JNI_DqrxbNode extends DqrxbNode { + @Override + @TruffleBoundary + public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] xb) { + native_dqrxb(x, n, k, qraux, y, ny, xb); + } + } + @Override public Dqrdc2Node createDqrdc2Node() { return new JNI_Dqrdc2Node(); @@ -66,6 +98,26 @@ public class JNI_RAppl implements RApplRFFI { return new JNI_DqrlsNode(); } + @Override + public DqrqtyNode createDqrqtyNode() { + return new JNI_DqrqtyNode(); + } + + @Override + public DqrqyNode createDqrqyNode() { + return new JNI_DqrqyNode(); + } + + @Override + public DqrrsdNode createDqrrsdNode() { + return new JNI_DqrrsdNode(); + } + + @Override + public DqrxbNode createDqrxbNode() { + return new JNI_DqrxbNode(); + } + // Checkstyle: stop method name private static native void native_dqrdc2(double[] x, int ldx, int n, int p, double tol, int[] rank, double[] qraux, int[] pivot, double[] work); @@ -74,4 +126,11 @@ public class JNI_RAppl implements RApplRFFI { private static native void native_dqrls(double[] x, int n, int p, double[] y, int ny, double tol, double[] b, double[] rsd, double[] qty, int[] k, int[] jpvt, double[] qraux, double[] work); + private static native void native_dqrqty(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qty); + + private static native void native_dqrqy(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qy); + + private static native void native_dqrrsd(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] rsd); + + private static native void native_dqrxb(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] xb); } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RAppl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RAppl.java index c65038607879646c2e5f11bd42f4bbcafee13bce..c162b65dc494ea2d51063dde4dd92ca97bddd1e3 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RAppl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RAppl.java @@ -148,4 +148,24 @@ public class TruffleLLVM_RAppl implements RApplRFFI { public DqrlsNode createDqrlsNode() { return new TruffleLLVM_DqrlsNode(); } + + @Override + public DqrqtyNode createDqrqtyNode() { + throw RInternalError.unimplemented(); + } + + @Override + public DqrqyNode createDqrqyNode() { + throw RInternalError.unimplemented(); + } + + @Override + public DqrrsdNode createDqrrsdNode() { + throw RInternalError.unimplemented(); + } + + @Override + public DqrxbNode createDqrxbNode() { + throw RInternalError.unimplemented(); + } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_RFFIFactory.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_RFFIFactory.java index 68f7bf84977360d4c2a9defa505b77a64fbf9f36..81661a2c8fc7ea0dc9f1fe423657545fb7cd0892 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_RFFIFactory.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_RFFIFactory.java @@ -24,6 +24,7 @@ package com.oracle.truffle.r.ffi.impl.managed; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.context.RContext.ContextState; @@ -80,6 +81,26 @@ public class Managed_RFFIFactory extends RFFIFactory implements RFFI { public DqrlsNode createDqrlsNode() { throw unsupported("dqrls"); } + + @Override + public DqrqtyNode createDqrqtyNode() { + throw RInternalError.unimplemented(); + } + + @Override + public DqrqyNode createDqrqyNode() { + throw RInternalError.unimplemented(); + } + + @Override + public DqrrsdNode createDqrrsdNode() { + throw RInternalError.unimplemented(); + } + + @Override + public DqrxbNode createDqrxbNode() { + throw RInternalError.unimplemented(); + } }; } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/NFIFunction.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/NFIFunction.java index dec5273c90fa3d8fa8843eedaff563fdcd2a9763..cd543c6fd69eeca9ed66435e35307db844e9a681 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/NFIFunction.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/NFIFunction.java @@ -60,6 +60,10 @@ enum NFIFunction { dqrdc2("([double], sint32, sint32, sint32, double, [sint32], [double], [sint32], [double]): void", "call_appl_"), dqrcf("([double], sint32, sint32, [double], [double], sint32, [double], [sint32]): void", "call_appl_"), dqrls("([double], sint32, sint32, [double], sint32, double, [double], [double], [double], [sint32], [sint32], [double], [double]): void", "call_appl_"), + dqrqty("([double], sint32, sint32, [double], [double], sint32, [double]): void", "call_appl_"), + dqrqy("([double], sint32, sint32, [double], [double], sint32, [double]): void", "call_appl_"), + dqrrsd("([double], sint32, sint32, [double], [double], sint32, [double]): void", "call_appl_"), + dqrxb("([double], sint32, sint32, [double], [double], sint32, [double]): void", "call_appl_"), // zip compress("([uint8], [uint64], [uint8], uint64): sint32"), uncompress("([uint8], [uint64], [uint8], uint64): sint32"), diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RAppl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RAppl.java index 5bd5362aa8f71811fd28fc57d3569e20bddb59fc..699b3542265fee1351140de3f89ca8b644693796 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RAppl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RAppl.java @@ -96,6 +96,86 @@ public class TruffleNFI_RAppl implements RApplRFFI { } } + private static class TruffleNFI_DqrqtyNode extends DqrqtyNode { + @Child private Node message = NFIFunction.dqrqty.createMessage(); + + @Override + public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qty) { + try { + ForeignAccess.sendExecute(message, NFIFunction.dqrqty.getFunction(), + JavaInterop.asTruffleObject(x), + n, k, + JavaInterop.asTruffleObject(qraux), + JavaInterop.asTruffleObject(y), + ny, + JavaInterop.asTruffleObject(qty)); + + } catch (InteropException e) { + throw RInternalError.shouldNotReachHere(e); + } + } + } + + private static class TruffleNFI_DqrqyNode extends DqrqyNode { + @Child private Node message = NFIFunction.dqrqy.createMessage(); + + @Override + public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qy) { + try { + ForeignAccess.sendExecute(message, NFIFunction.dqrqy.getFunction(), + JavaInterop.asTruffleObject(x), + n, k, + JavaInterop.asTruffleObject(qraux), + JavaInterop.asTruffleObject(y), + ny, + JavaInterop.asTruffleObject(qy)); + + } catch (InteropException e) { + throw RInternalError.shouldNotReachHere(e); + } + } + } + + private static class TruffleNFI_DqrrsdNode extends DqrrsdNode { + @Child private Node message = NFIFunction.dqrrsd.createMessage(); + + @Override + public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] rsd) { + try { + ForeignAccess.sendExecute(message, NFIFunction.dqrrsd.getFunction(), + JavaInterop.asTruffleObject(x), + n, k, + JavaInterop.asTruffleObject(qraux), + JavaInterop.asTruffleObject(y), + ny, + JavaInterop.asTruffleObject(rsd)); + + } catch (InteropException e) { + throw RInternalError.shouldNotReachHere(e); + } + } + } + + private static class TruffleNFI_DqrxbNode extends DqrxbNode { + @Child private Node message = NFIFunction.dqrxb.createMessage(); + + @Override + public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] xb) { + try { + ForeignAccess.sendExecute(message, NFIFunction.dqrxb.getFunction(), + JavaInterop.asTruffleObject(x), + n, k, + JavaInterop.asTruffleObject(qraux), + JavaInterop.asTruffleObject(y), + ny, + JavaInterop.asTruffleObject(xb)); + + } catch (InteropException e) { + throw RInternalError.shouldNotReachHere(e); + } + } + } + @Override public Dqrdc2Node createDqrdc2Node() { return new TruffleNFI_Dqrdc2Node(); @@ -110,4 +190,24 @@ public class TruffleNFI_RAppl implements RApplRFFI { public DqrlsNode createDqrlsNode() { return new TruffleNFI_DqrlsNode(); } + + @Override + public DqrqtyNode createDqrqtyNode() { + return new TruffleNFI_DqrqtyNode(); + } + + @Override + public DqrqyNode createDqrqyNode() { + return new TruffleNFI_DqrqyNode(); + } + + @Override + public DqrrsdNode createDqrrsdNode() { + return new TruffleNFI_DqrrsdNode(); + } + + @Override + public DqrxbNode createDqrxbNode() { + return new TruffleNFI_DqrxbNode(); + } } diff --git a/com.oracle.truffle.r.native/fficall/src/jni/Rmath.c b/com.oracle.truffle.r.native/fficall/src/jni/Rmath.c index 2182b9c413902d5ac2bd03bad3fa91c6a3a896c5..fd82bd58721f03a9131a6453dd480dec48096d7e 100644 --- a/com.oracle.truffle.r.native/fficall/src/jni/Rmath.c +++ b/com.oracle.truffle.r.native/fficall/src/jni/Rmath.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -682,8 +682,11 @@ double Rf_fprec(double a, double b) { } double Rf_fsign(double a, double b) { - unimplemented("Rf_fsign"); - return 0; +#ifdef IEEE_754 + if (ISNAN(a) || ISNAN(b)) + return a + b; +#endif + return ((b >= 0) ? fabs(a) : -fabs(b)); } double Rf_ftrunc(double a) { diff --git a/com.oracle.truffle.r.native/fficall/src/jni/appl_rffi.c b/com.oracle.truffle.r.native/fficall/src/jni/appl_rffi.c index feb67c1825778a5a6fb1c4bd28e0b3167b662155..c47930bf89edfdb2e9eacd44b206bb5c8baf091e 100644 --- a/com.oracle.truffle.r.native/fficall/src/jni/appl_rffi.c +++ b/com.oracle.truffle.r.native/fficall/src/jni/appl_rffi.c @@ -26,6 +26,10 @@ extern void dqrdc2_(double *x, int *ldx, int *n, int *p, double *tol, int *rank, double *qraux, int* pivot, double *work); extern void dqrcf_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *b, int* info); extern void dqrls_(double *x, int *n, int *p, double *y, int *ny, double *tol, double *b, double *rsd, double *qty, int *k, int *jpvt, double *qraux, double *work); +extern void dqrqty_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *qty); +extern void dqrqy_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *qy); +extern void dqrrsd_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *rsd); +extern void dqrxb_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *xb); JNIEXPORT void JNICALL Java_com_oracle_truffle_r_ffi_impl_jni_JNI_1RAppl_native_1dqrdc2(JNIEnv *env, jclass c, @@ -84,3 +88,59 @@ Java_com_oracle_truffle_r_ffi_impl_jni_JNI_1RAppl_native_1dqrls(JNIEnv *env, jcl (*env)->ReleasePrimitiveArrayCritical(env, jqraux, qraux, 0); (*env)->ReleasePrimitiveArrayCritical(env, jwork, work, 0); } + +JNIEXPORT void JNICALL +Java_com_oracle_truffle_r_ffi_impl_jni_JNI_1RAppl_native_1dqrqty(JNIEnv *env, jclass c, + jdoubleArray jx, int n, int k, jdoubleArray jqraux, jdoubleArray jy, int ny, jdoubleArray jqty) { + double *x = (*env)->GetPrimitiveArrayCritical(env, jx, NULL); + double *qraux = (*env)->GetPrimitiveArrayCritical(env, jqraux, NULL); + double *y = (*env)->GetPrimitiveArrayCritical(env, jy, NULL); + double *qty = (*env)->GetPrimitiveArrayCritical(env, jqty, NULL); + dqrqty_(x, &n, &k, qraux, y, &ny, qty); + (*env)->ReleasePrimitiveArrayCritical(env, jx, x, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jqraux, qraux, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jy, y, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jqty, qty, 0); +} + +JNIEXPORT void JNICALL +Java_com_oracle_truffle_r_ffi_impl_jni_JNI_1RAppl_native_1dqrqy(JNIEnv *env, jclass c, + jdoubleArray jx, int n, int k, jdoubleArray jqraux, jdoubleArray jy, int ny, jdoubleArray jqy) { + double *x = (*env)->GetPrimitiveArrayCritical(env, jx, NULL); + double *qraux = (*env)->GetPrimitiveArrayCritical(env, jqraux, NULL); + double *y = (*env)->GetPrimitiveArrayCritical(env, jy, NULL); + double *qy = (*env)->GetPrimitiveArrayCritical(env, jqy, NULL); + dqrqy_(x, &n, &k, qraux, y, &ny, qy); + (*env)->ReleasePrimitiveArrayCritical(env, jx, x, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jqraux, qraux, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jy, y, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jqy, qy, 0); +} + +JNIEXPORT void JNICALL +Java_com_oracle_truffle_r_ffi_impl_jni_JNI_1RAppl_native_1dqrrsd(JNIEnv *env, jclass c, + jdoubleArray jx, int n, int k, jdoubleArray jqraux, jdoubleArray jy, int ny, jdoubleArray jrsd) { + double *x = (*env)->GetPrimitiveArrayCritical(env, jx, NULL); + double *qraux = (*env)->GetPrimitiveArrayCritical(env, jqraux, NULL); + double *y = (*env)->GetPrimitiveArrayCritical(env, jy, NULL); + double *rsd = (*env)->GetPrimitiveArrayCritical(env, jrsd, NULL); + dqrrsd_(x, &n, &k, qraux, y, &ny, rsd); + (*env)->ReleasePrimitiveArrayCritical(env, jx, x, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jqraux, qraux, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jy, y, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jrsd, rsd, 0); +} + +JNIEXPORT void JNICALL +Java_com_oracle_truffle_r_ffi_impl_jni_JNI_1RAppl_native_1dqrxb(JNIEnv *env, jclass c, + jdoubleArray jx, int n, int k, jdoubleArray jqraux, jdoubleArray jy, int ny, jdoubleArray jxb) { + double *x = (*env)->GetPrimitiveArrayCritical(env, jx, NULL); + double *qraux = (*env)->GetPrimitiveArrayCritical(env, jqraux, NULL); + double *y = (*env)->GetPrimitiveArrayCritical(env, jy, NULL); + double *xb = (*env)->GetPrimitiveArrayCritical(env, jxb, NULL); + dqrxb_(x, &n, &k, qraux, y, &ny, xb); + (*env)->ReleasePrimitiveArrayCritical(env, jx, x, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jqraux, qraux, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jy, y, 0); + (*env)->ReleasePrimitiveArrayCritical(env, jxb, xb, 0); +} diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_nfi/Rmath.c b/com.oracle.truffle.r.native/fficall/src/truffle_nfi/Rmath.c index f9ea65f0db4bdb5c3578d1bf2bc3b5854c719a7c..fd9580d182b294ed8f86cd0cf65df2bb9f350e5c 100644 --- a/com.oracle.truffle.r.native/fficall/src/truffle_nfi/Rmath.c +++ b/com.oracle.truffle.r.native/fficall/src/truffle_nfi/Rmath.c @@ -678,8 +678,11 @@ double Rf_fprec(double a, double b) { } double Rf_fsign(double a, double b) { - unimplemented("Rf_fsign"); - return 0; +#ifdef IEEE_754 + if (ISNAN(a) || ISNAN(b)) + return a + b; +#endif + return ((b >= 0) ? fabs(a) : -fabs(b)); } double Rf_ftrunc(double a) { diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_nfi/appl_rffi.c b/com.oracle.truffle.r.native/fficall/src/truffle_nfi/appl_rffi.c index bd83ecff1ee4a6596df52c35e1794a63a8f5b9c5..f54ca8877376e9c2364ffa94b07e260a34f41354 100644 --- a/com.oracle.truffle.r.native/fficall/src/truffle_nfi/appl_rffi.c +++ b/com.oracle.truffle.r.native/fficall/src/truffle_nfi/appl_rffi.c @@ -26,6 +26,10 @@ extern void dqrdc2_(double *x, int *ldx, int *n, int *p, double *tol, int *rank, double *qraux, int* pivot, double *work); extern void dqrcf_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *b, int* info); extern void dqrls_(double *x, int *n, int *p, double *y, int *ny, double *tol, double *b, double *rsd, double *qty, int *k, int *jpvt, double *qraux, double *work); +extern void dqrqty_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *qty); +extern void dqrqy_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *qy); +extern void dqrrsd_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *rsd); +extern void dqrxb_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *xb); void call_appl_dqrdc2(double *x, int ldx, int n, int p, double tol, int *rank, double *qraux, int* pivot, double *work) { dqrdc2_(x, &ldx, &n, &p, &tol, rank, qraux, pivot, work); @@ -38,3 +42,19 @@ void call_appl_dqrcf(double *x, int n, int k, double *qraux, double *y, int ny, void call_appl_dqrls(double *x, int n, int p, double *y, int ny, double tol, double *b, double *rsd, double *qty, int *k, int *jpvt, double *qraux, double *work) { dqrls_(x, &n, &p, y, &ny, &tol, b, rsd, qty, k, jpvt, qraux, work); } + +void call_appl_dqrqty(double *x, int n, int k, double *qraux, double *y, int ny, double *qty) { + dqrqty_(x, &n, &k, qraux, y, &ny, qty); +} + +void call_appl_dqrqy(double *x, int n, int k, double *qraux, double *y, int ny, double *qy) { + dqrqy_(x, &n, &k, qraux, y, &ny, qy); +} + +void call_appl_dqrrsd(double *x, int n, int k, double *qraux, double *y, int ny, double *rsd) { + dqrrsd_(x, &n, &k, qraux, y, &ny, rsd); +} + +void call_appl_dqrxb(double *x, int n, int k, double *qraux, double *y, int ny, double *xb) { + dqrxb_(x, &n, &k, qraux, y, &ny, xb); +} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java index 93d2a214721c73a0d532933585bf56ebb6fed4ce..4f04292599ff7e04365ccd2a9dcbe7eb9dedf4ca 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java @@ -11,9 +11,10 @@ */ package com.oracle.truffle.r.nodes.builtin.base.foreign; -import com.oracle.truffle.api.dsl.Specialization; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; + +import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; @@ -34,14 +35,14 @@ public abstract class Dqrcf extends RExternalBuiltinNode.Arg8 { static { Casts casts = new Casts(Dqrcf.class); - casts.arg(0).mustBe(doubleValue()).asDoubleVector(); - casts.arg(1).mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(2).mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(3).mustBe(doubleValue()).asDoubleVector(); - casts.arg(4).mustBe(doubleValue()).asDoubleVector(); - casts.arg(5).mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(6).mustBe(doubleValue()).asDoubleVector(); - casts.arg(7).mustBe(integerValue()).asIntegerVector(); + casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); + casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); + casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); + casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(6, "b").mustBe(doubleValue()).asDoubleVector(); + casts.arg(7, "info").mustBe(integerValue()).asIntegerVector(); } @Specialization diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqty.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqty.java new file mode 100644 index 0000000000000000000000000000000000000000..e1926ed0d7e977e5b45aea7a5e354406b1780249 --- /dev/null +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqty.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.nodes.builtin.base.foreign; + +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; + +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; +import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.data.RDataFactory; +import com.oracle.truffle.r.runtime.data.RDoubleVector; +import com.oracle.truffle.r.runtime.data.RList; +import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; +import com.oracle.truffle.r.runtime.ffi.RApplRFFI; +import com.oracle.truffle.r.runtime.ffi.RFFIFactory; + +public abstract class Dqrqty extends RExternalBuiltinNode.Arg7 { + @Child private RApplRFFI.DqrqtyNode dqrqtyNode = RFFIFactory.getRFFI().getRApplRFFI().createDqrqtyNode(); + + static { + Casts casts = new Casts(Dqrqty.class); + casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); + casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); + casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); + casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(6, "b").mustBe(doubleValue()).asDoubleVector(); + } + + @Specialization + public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector bVec) { + try { + double[] x = xVec.materialize().getDataTemp(); + double[] qraux = qrauxVec.materialize().getDataTemp(); + double[] y = yVec.materialize().getDataTemp(); + double[] b = bVec.materialize().getDataTemp(); + dqrqtyNode.execute(x, nx, k, qraux, y, ny, b); + RDoubleVector coef = RDataFactory.createDoubleVector(b, RDataFactory.COMPLETE_VECTOR); + coef.copyAttributesFrom(bVec); + // @formatter:off + Object[] data = new Object[]{ + RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), + nx, + k, + RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), + RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), + ny, + coef, + }; + // @formatter:on + return RDataFactory.createList(data); + + } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { + throw error(RError.Message.INCORRECT_ARG, "dqrqty"); + } + } +} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqy.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqy.java new file mode 100644 index 0000000000000000000000000000000000000000..a47e4a14a1c2fe2485c56abe1a4a047210739944 --- /dev/null +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqy.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.nodes.builtin.base.foreign; + +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; + +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; +import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.data.RDataFactory; +import com.oracle.truffle.r.runtime.data.RDoubleVector; +import com.oracle.truffle.r.runtime.data.RList; +import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; +import com.oracle.truffle.r.runtime.ffi.RApplRFFI; +import com.oracle.truffle.r.runtime.ffi.RFFIFactory; + +public abstract class Dqrqy extends RExternalBuiltinNode.Arg7 { + @Child private RApplRFFI.DqrqyNode dqrqyNode = RFFIFactory.getRFFI().getRApplRFFI().createDqrqyNode(); + + static { + Casts casts = new Casts(Dqrqy.class); + casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); + casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); + casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); + casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(6, "b").mustBe(doubleValue()).asDoubleVector(); + } + + @Specialization + public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector bVec) { + try { + double[] x = xVec.materialize().getDataTemp(); + double[] qraux = qrauxVec.materialize().getDataTemp(); + double[] y = yVec.materialize().getDataTemp(); + double[] b = bVec.materialize().getDataTemp(); + dqrqyNode.execute(x, nx, k, qraux, y, ny, b); + RDoubleVector coef = RDataFactory.createDoubleVector(b, RDataFactory.COMPLETE_VECTOR); + coef.copyAttributesFrom(bVec); + // @formatter:off + Object[] data = new Object[]{ + RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), + nx, + k, + RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), + RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), + ny, + coef, + }; + // @formatter:on + return RDataFactory.createList(data); + + } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { + throw error(RError.Message.INCORRECT_ARG, "dqrqy"); + } + } +} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrrsd.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrrsd.java new file mode 100644 index 0000000000000000000000000000000000000000..f5b161299c9958ee59c2804d06d3b5f603f4fe25 --- /dev/null +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrrsd.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.nodes.builtin.base.foreign; + +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; + +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; +import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.data.RDataFactory; +import com.oracle.truffle.r.runtime.data.RDoubleVector; +import com.oracle.truffle.r.runtime.data.RList; +import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; +import com.oracle.truffle.r.runtime.ffi.RApplRFFI; +import com.oracle.truffle.r.runtime.ffi.RFFIFactory; + +public abstract class Dqrrsd extends RExternalBuiltinNode.Arg7 { + @Child private RApplRFFI.DqrrsdNode dqrrsdNode = RFFIFactory.getRFFI().getRApplRFFI().createDqrrsdNode(); + + static { + Casts casts = new Casts(Dqrrsd.class); + casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); + casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); + casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); + casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(6, "rsd").mustBe(doubleValue()).asDoubleVector(); + } + + @Specialization + public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector rsdVec) { + try { + double[] x = xVec.materialize().getDataTemp(); + double[] qraux = qrauxVec.materialize().getDataTemp(); + double[] y = yVec.materialize().getDataTemp(); + double[] rsd = rsdVec.materialize().getDataTemp(); + dqrrsdNode.execute(x, nx, k, qraux, y, ny, rsd); + RDoubleVector coef = RDataFactory.createDoubleVector(rsd, RDataFactory.COMPLETE_VECTOR); + coef.copyAttributesFrom(rsdVec); + // @formatter:off + Object[] data = new Object[]{ + RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), + nx, + k, + RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), + RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), + ny, + coef, + }; + // @formatter:on + return RDataFactory.createList(data); + + } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { + throw error(RError.Message.INCORRECT_ARG, "dqrrsd"); + } + } +} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrxb.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrxb.java new file mode 100644 index 0000000000000000000000000000000000000000..5e4a1d742fcef1ce98f2824d206d353606e509df --- /dev/null +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrxb.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.nodes.builtin.base.foreign; + +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; + +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; +import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.data.RDataFactory; +import com.oracle.truffle.r.runtime.data.RDoubleVector; +import com.oracle.truffle.r.runtime.data.RList; +import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; +import com.oracle.truffle.r.runtime.ffi.RApplRFFI; +import com.oracle.truffle.r.runtime.ffi.RFFIFactory; + +public abstract class Dqrxb extends RExternalBuiltinNode.Arg7 { + @Child private RApplRFFI.DqrxbNode dqrrsdNode = RFFIFactory.getRFFI().getRApplRFFI().createDqrxbNode(); + + static { + Casts casts = new Casts(Dqrxb.class); + casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); + casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); + casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); + casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); + casts.arg(6, "xb").mustBe(doubleValue()).asDoubleVector(); + } + + @Specialization + public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector xbVec) { + try { + double[] x = xVec.materialize().getDataTemp(); + double[] qraux = qrauxVec.materialize().getDataTemp(); + double[] y = yVec.materialize().getDataTemp(); + double[] xb = xbVec.materialize().getDataTemp(); + dqrrsdNode.execute(x, nx, k, qraux, y, ny, xb); + RDoubleVector coef = RDataFactory.createDoubleVector(xb, RDataFactory.COMPLETE_VECTOR); + coef.copyAttributesFrom(xbVec); + // @formatter:off + Object[] data = new Object[]{ + RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), + nx, + k, + RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), + RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), + ny, + coef, + }; + // @formatter:on + return RDataFactory.createList(data); + + } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { + throw error(RError.Message.INCORRECT_ARG, "dqrxb"); + } + } +} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java index 9665e68e3081cbfa66c2f13dd2b8212db3deb626..050194c0e67ad37ddb1b7e0c5c399cc9d50b0d72 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java @@ -259,6 +259,14 @@ public class FortranAndCFunctions { return Dqrdc2.create(); case "dqrcf": return DqrcfNodeGen.create(); + case "dqrqty": + return DqrqtyNodeGen.create(); + case "dqrqy": + return DqrqyNodeGen.create(); + case "dqrrsd": + return DqrrsdNodeGen.create(); + case "dqrxb": + return DqrxbNodeGen.create(); default: return null; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RApplRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RApplRFFI.java index a8e4d2aa6dfb3ca4e740913ef8b28a1fad4b152e..d24fa19c95f553d1a6bfa1b3da03c0b45942a377 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RApplRFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RApplRFFI.java @@ -54,10 +54,50 @@ public interface RApplRFFI { } } + abstract class DqrqtyNode extends Node { + public abstract void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qty); + + public static DqrqtyNode create() { + + return RFFIFactory.getRFFI().getRApplRFFI().createDqrqtyNode(); + } + } + + abstract class DqrqyNode extends Node { + public abstract void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qy); + + public static DqrqyNode create() { + return RFFIFactory.getRFFI().getRApplRFFI().createDqrqyNode(); + } + } + + abstract class DqrrsdNode extends Node { + public abstract void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] rsd); + + public static DqrrsdNode create() { + return RFFIFactory.getRFFI().getRApplRFFI().createDqrrsdNode(); + } + } + + abstract class DqrxbNode extends Node { + public abstract void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] xb); + + public static DqrxbNode create() { + return RFFIFactory.getRFFI().getRApplRFFI().createDqrxbNode(); + } + } + Dqrdc2Node createDqrdc2Node(); DqrcfNode createDqrcfNode(); DqrlsNode createDqrlsNode(); + DqrqtyNode createDqrqtyNode(); + + DqrqyNode createDqrqyNode(); + + DqrrsdNode createDqrrsdNode(); + + DqrxbNode createDqrxbNode(); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 995ee484597b35312b3a0d0ff8213f0dc419c2da..ea5d9c8c97e3a15021825d6f66361f5f2f9c09f8 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -22473,6 +22473,159 @@ FALSE #argv <- list(c(0.00508571428571428, 0.876285714285715), structure(1L, class = c('terminal', 'connection')), 69); .Internal(dput(argv[[1]], argv[[2]], argv[[3]])) c(0.00508571428571428, 0.876285714285715) +##com.oracle.truffle.r.test.builtins.TestBuiltin_dqr.testdqrcf#Ignored.OutputFormatting# +#.Fortran(.F_dqrcf, 1, 1L, 1L, 1, 1, 1L, 1, 1L) +[[1]] +[1] 1 + +[[2]] +[1] 1 + +[[3]] +[1] 1 + +[[4]] +[1] 1 + +[[5]] +[1] 1 + +[[6]] +[1] 1 + +[[7]] +[1] 1 + +[[8]] +[1] 0 + + +##com.oracle.truffle.r.test.builtins.TestBuiltin_dqr.testdqrdc2#Ignored.OutputFormatting# +#.Fortran(.F_dqrdc2, 1, 1L, 1L, 1L, 1, 1L, 1, 1L, 1) +[[1]] +[1] 1 + +[[2]] +[1] 1 + +[[3]] +[1] 1 + +[[4]] +[1] 1 + +[[5]] +[1] 1 + +[[6]] +[1] 1 + +[[7]] +[1] 1 + +[[8]] +NULL + +[[9]] +[1] 1 + + +##com.oracle.truffle.r.test.builtins.TestBuiltin_dqr.testdqrqty# +#.Fortran(.F_dqrqty, 1, 1L, 1L, 1, 1, 1L, 1) +[[1]] +[1] 1 + +[[2]] +[1] 1 + +[[3]] +[1] 1 + +[[4]] +[1] 1 + +[[5]] +[1] 1 + +[[6]] +[1] 1 + +[[7]] +[1] 1 + + +##com.oracle.truffle.r.test.builtins.TestBuiltin_dqr.testdqrqy# +#.Fortran(.F_dqrqy, 1, 1L, 1L, 1, 1, 1L, 1) +[[1]] +[1] 1 + +[[2]] +[1] 1 + +[[3]] +[1] 1 + +[[4]] +[1] 1 + +[[5]] +[1] 1 + +[[6]] +[1] 1 + +[[7]] +[1] 1 + + +##com.oracle.truffle.r.test.builtins.TestBuiltin_dqr.testdqrrsd# +#.Fortran(.F_dqrrsd, 1, 1L, 1L, 1, 1, 1L, 1) +[[1]] +[1] 1 + +[[2]] +[1] 1 + +[[3]] +[1] 1 + +[[4]] +[1] 1 + +[[5]] +[1] 1 + +[[6]] +[1] 1 + +[[7]] +[1] 0 + + +##com.oracle.truffle.r.test.builtins.TestBuiltin_dqr.testdqrxb# +#.Fortran(.F_dqrxb, 1, 1L, 1L, 1, 1, 1L, 1) +[[1]] +[1] 1 + +[[2]] +[1] 1 + +[[3]] +[1] 1 + +[[4]] +[1] 1 + +[[5]] +[1] 1 + +[[6]] +[1] 1 + +[[7]] +[1] 1 + + ##com.oracle.truffle.r.test.builtins.TestBuiltin_drop.testDrop# #a <- matrix(1:6, 3, 2, dimnames=list(1:3, c(' ','x'))); b <- array(c(1,2), dim=c(2), dimnames=list(c('int', 'x'))); drop(a %*% b); 1 2 3 diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_dqr.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_dqr.java new file mode 100644 index 0000000000000000000000000000000000000000..52ea765150439641f423f22685c404be835fa265 --- /dev/null +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_dqr.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.test.builtins; + +import org.junit.Test; + +import com.oracle.truffle.r.test.TestBase; + +// Checkstyle: stop line length check +public class TestBuiltin_dqr extends TestBase { + + @Test + public void testdqrdc2() { + assertEval(Ignored.OutputFormatting, ".Fortran(.F_dqrdc2, 1, 1L, 1L, 1L, 1, 1L, 1, 1L, 1)"); + } + + @Test + public void testdqrcf() { + assertEval(Ignored.OutputFormatting, ".Fortran(.F_dqrcf, 1, 1L, 1L, 1, 1, 1L, 1, 1L)"); + } + + @Test + public void testdqrqty() { + assertEval(".Fortran(.F_dqrqty, 1, 1L, 1L, 1, 1, 1L, 1)"); + } + + @Test + public void testdqrqy() { + assertEval(".Fortran(.F_dqrqy, 1, 1L, 1L, 1, 1, 1L, 1)"); + } + + @Test + public void testdqrrsd() { + assertEval(".Fortran(.F_dqrrsd, 1, 1L, 1L, 1, 1, 1L, 1)"); + } + + @Test + public void testdqrxb() { + assertEval(".Fortran(.F_dqrxb, 1, 1L, 1L, 1, 1, 1L, 1)"); + } +}