本文整理汇总了Java中org.renjin.sexp.DoubleVector.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java DoubleVector.EMPTY属性的具体用法?Java DoubleVector.EMPTY怎么用?Java DoubleVector.EMPTY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.renjin.sexp.DoubleVector
的用法示例。
在下文中一共展示了DoubleVector.EMPTY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0)
throws Exception
{
if ((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if ((cycles > 100)||(vector0 instanceof DeferredComputation)) {
return new R$primitive$abs$deferred_d(vector0, vector0 .getAttributes().copyStructural());
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)) {
builder.setNA(i);
} else {
builder.set(i, MathExt.abs(vector0 .getElementAsDouble(currentElementIndex0)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tabs(%s)\n\tExpected:\n\tabs(double)", arg0 .getTypeName()));
}
}
示例2: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0)
throws Exception
{
if ((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if ((cycles > 100)||(vector0 instanceof DeferredComputation)) {
return new R$primitive$sinh$deferred_d(vector0, vector0 .getAttributes().copyStructural());
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)) {
builder.setNA(i);
} else {
builder.set(i, Math.sinh(vector0 .getElementAsDouble(currentElementIndex0)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tsinh(%s)\n\tExpected:\n\tsinh(double)", arg0 .getTypeName()));
}
}
示例3: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0)
throws Exception
{
if ((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if ((cycles > 100)||(vector0 instanceof DeferredComputation)) {
return new R$primitive$tan$deferred_d(vector0, vector0 .getAttributes().copyStructural());
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)) {
builder.setNA(i);
} else {
builder.set(i, Math.tan(vector0 .getElementAsDouble(currentElementIndex0)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\ttan(%s)\n\tExpected:\n\ttan(double)", arg0 .getTypeName()));
}
}
示例4: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0)
throws Exception
{
if ((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if ((cycles > 100)||(vector0 instanceof DeferredComputation)) {
return new R$primitive$cosh$deferred_d(vector0, vector0 .getAttributes().copyStructural());
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)) {
builder.setNA(i);
} else {
builder.set(i, Math.cosh(vector0 .getElementAsDouble(currentElementIndex0)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tcosh(%s)\n\tExpected:\n\tcosh(double)", arg0 .getTypeName()));
}
}
示例5: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0)
throws Exception
{
if ((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if ((cycles > 100)||(vector0 instanceof DeferredComputation)) {
return new R$primitive$cos$deferred_d(vector0, vector0 .getAttributes().copyStructural());
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)) {
builder.setNA(i);
} else {
builder.set(i, Math.cos(vector0 .getElementAsDouble(currentElementIndex0)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tcos(%s)\n\tExpected:\n\tcos(double)", arg0 .getTypeName()));
}
}
示例6: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0)
throws Exception
{
if ((arg0 .length() == 0)||((arg0 instanceof Vector)&&ComplexVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)) {
builder.setNA(i);
} else {
builder.set(i, ComplexGroup.Im(vector0 .getElementAsComplex(currentElementIndex0)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tIm(%s)\n\tExpected:\n\tIm(Complex)", arg0 .getTypeName()));
}
}
示例7: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0)
throws Exception
{
if ((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if ((cycles > 100)||(vector0 instanceof DeferredComputation)) {
return new R$primitive$sin$deferred_d(vector0, vector0 .getAttributes().copyStructural());
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)) {
builder.setNA(i);
} else {
builder.set(i, Math.sin(vector0 .getElementAsDouble(currentElementIndex0)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tsin(%s)\n\tExpected:\n\tsin(double)", arg0 .getTypeName()));
}
}
示例8: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0)
throws Exception
{
if ((arg0 .length() == 0)||((arg0 instanceof Vector)&&ComplexVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)) {
builder.setNA(i);
} else {
builder.set(i, ComplexGroup.Re(vector0 .getElementAsComplex(currentElementIndex0)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tRe(%s)\n\tExpected:\n\tRe(Complex)", arg0 .getTypeName()));
}
}
示例9: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0, SEXP arg1, SEXP arg2, SEXP arg3, SEXP arg4)
throws Exception
{
if ((((((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0))))&&((arg1 .length() == 0)||((arg1 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg1)))))&&((arg2 .length() == 0)||((arg2 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg2)))))&&(arg3 instanceof Vector))&&(arg4 instanceof Vector)) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
Vector vector1 = ((Vector) WrapperRuntime.convertToVector(arg1));
int length1 = vector1 .length();
int currentElementIndex1 = 0;
Vector vector2 = ((Vector) WrapperRuntime.convertToVector(arg2));
int length2 = vector2 .length();
int currentElementIndex2 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if (length1 == 0) {
return DoubleVector.EMPTY;
}
if (length1 >cycles) {
cycles = length1;
}
if (length2 == 0) {
return DoubleVector.EMPTY;
}
if (length2 >cycles) {
cycles = length2;
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if ((vector0 .isElementNA(currentElementIndex0)||vector1 .isElementNA(currentElementIndex1))||vector2 .isElementNA(currentElementIndex2)) {
builder.setNA(i);
} else {
builder.set(i, Distributions.qbeta(vector0 .getElementAsDouble(currentElementIndex0), vector1 .getElementAsDouble(currentElementIndex1), vector2 .getElementAsDouble(currentElementIndex2), WrapperRuntime.convertToBooleanPrimitive(arg3), WrapperRuntime.convertToBooleanPrimitive(arg4)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
currentElementIndex1 += 1;
if (currentElementIndex1 == length1) {
currentElementIndex1 = 0;
}
currentElementIndex2 += 1;
if (currentElementIndex2 == length2) {
currentElementIndex2 = 0;
}
}
if (length2 == cycles) {
builder.copySomeAttributesFrom(vector2, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length1 == cycles) {
builder.copySomeAttributesFrom(vector1, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tqbeta(%s, %s, %s, %s, %s)\n\tExpected:\n\tqbeta(double, double, double, logical(1), logical(1))", arg0 .getTypeName(), arg1 .getTypeName(), arg2 .getTypeName(), arg3 .getTypeName(), arg4 .getTypeName()));
}
}
示例10: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0, SEXP arg1)
throws Exception
{
if (((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0))))&&((arg1 .length() == 0)||(((arg1 instanceof IntVector)||(arg1 instanceof DoubleVector))||(arg1 instanceof LogicalVector)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
Vector vector1 = ((Vector) WrapperRuntime.convertToVector(arg1));
int length1 = vector1 .length();
int currentElementIndex1 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if (length1 == 0) {
return DoubleVector.EMPTY;
}
if (length1 >cycles) {
cycles = length1;
}
if (((cycles > 100)||(vector0 instanceof DeferredComputation))||(vector1 instanceof DeferredComputation)) {
return new R$primitive$round$deferred_di(vector0, vector1, AttributeMap.combineStructuralAttributes(vector0, vector1));
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)||vector1 .isElementNA(currentElementIndex1)) {
builder.setNA(i);
} else {
builder.set(i, MathExt.round(vector0 .getElementAsDouble(currentElementIndex0), vector1 .getElementAsInt(currentElementIndex1)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
currentElementIndex1 += 1;
if (currentElementIndex1 == length1) {
currentElementIndex1 = 0;
}
}
if (length1 == cycles) {
builder.copySomeAttributesFrom(vector1, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tround(%s, %s)\n\tExpected:\n\tround(double)\n\tround(double, integer)", arg0 .getTypeName(), arg1 .getTypeName()));
}
}
示例11: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0, SEXP arg1)
throws Exception
{
if (((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0))))&&((arg1 .length() == 0)||(((arg1 instanceof IntVector)||(arg1 instanceof DoubleVector))||(arg1 instanceof LogicalVector)))) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
Vector vector1 = ((Vector) WrapperRuntime.convertToVector(arg1));
int length1 = vector1 .length();
int currentElementIndex1 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if (length1 == 0) {
return DoubleVector.EMPTY;
}
if (length1 >cycles) {
cycles = length1;
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)||vector1 .isElementNA(currentElementIndex1)) {
builder.setNA(i);
} else {
builder.set(i, MathExt.lchoose(vector0 .getElementAsDouble(currentElementIndex0), vector1 .getElementAsInt(currentElementIndex1)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
currentElementIndex1 += 1;
if (currentElementIndex1 == length1) {
currentElementIndex1 = 0;
}
}
if (length1 == cycles) {
builder.copySomeAttributesFrom(vector1, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tlchoose(%s, %s)\n\tExpected:\n\tlchoose(double, integer)", arg0 .getTypeName(), arg1 .getTypeName()));
}
}
示例12: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0, SEXP arg1, SEXP arg2, SEXP arg3, SEXP arg4)
throws Exception
{
if ((((((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0))))&&((arg1 .length() == 0)||((arg1 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg1)))))&&((arg2 .length() == 0)||((arg2 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg2)))))&&(arg3 instanceof Vector))&&(arg4 instanceof Vector)) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
Vector vector1 = ((Vector) WrapperRuntime.convertToVector(arg1));
int length1 = vector1 .length();
int currentElementIndex1 = 0;
Vector vector2 = ((Vector) WrapperRuntime.convertToVector(arg2));
int length2 = vector2 .length();
int currentElementIndex2 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if (length1 == 0) {
return DoubleVector.EMPTY;
}
if (length1 >cycles) {
cycles = length1;
}
if (length2 == 0) {
return DoubleVector.EMPTY;
}
if (length2 >cycles) {
cycles = length2;
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if ((vector0 .isElementNA(currentElementIndex0)||vector1 .isElementNA(currentElementIndex1))||vector2 .isElementNA(currentElementIndex2)) {
builder.setNA(i);
} else {
builder.set(i, Distributions.qcauchy(vector0 .getElementAsDouble(currentElementIndex0), vector1 .getElementAsDouble(currentElementIndex1), vector2 .getElementAsDouble(currentElementIndex2), WrapperRuntime.convertToBooleanPrimitive(arg3), WrapperRuntime.convertToBooleanPrimitive(arg4)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
currentElementIndex1 += 1;
if (currentElementIndex1 == length1) {
currentElementIndex1 = 0;
}
currentElementIndex2 += 1;
if (currentElementIndex2 == length2) {
currentElementIndex2 = 0;
}
}
if (length2 == cycles) {
builder.copySomeAttributesFrom(vector2, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length1 == cycles) {
builder.copySomeAttributesFrom(vector1, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tqcauchy(%s, %s, %s, %s, %s)\n\tExpected:\n\tqcauchy(double, double, double, logical(1), logical(1))", arg0 .getTypeName(), arg1 .getTypeName(), arg2 .getTypeName(), arg3 .getTypeName(), arg4 .getTypeName()));
}
}
示例13: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0, SEXP arg1, SEXP arg2, SEXP arg3)
throws Exception
{
if (((((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0))))&&((arg1 .length() == 0)||(((arg1 instanceof IntVector)||(arg1 instanceof DoubleVector))||(arg1 instanceof LogicalVector))))&&((arg2 .length() == 0)||((arg2 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg2)))))&&(arg3 instanceof Vector)) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
Vector vector1 = ((Vector) WrapperRuntime.convertToVector(arg1));
int length1 = vector1 .length();
int currentElementIndex1 = 0;
Vector vector2 = ((Vector) WrapperRuntime.convertToVector(arg2));
int length2 = vector2 .length();
int currentElementIndex2 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if (length1 == 0) {
return DoubleVector.EMPTY;
}
if (length1 >cycles) {
cycles = length1;
}
if (length2 == 0) {
return DoubleVector.EMPTY;
}
if (length2 >cycles) {
cycles = length2;
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if ((vector0 .isElementNA(currentElementIndex0)||vector1 .isElementNA(currentElementIndex1))||vector2 .isElementNA(currentElementIndex2)) {
builder.setNA(i);
} else {
builder.set(i, Distributions.dnbinom(vector0 .getElementAsDouble(currentElementIndex0), vector1 .getElementAsInt(currentElementIndex1), vector2 .getElementAsDouble(currentElementIndex2), WrapperRuntime.convertToBooleanPrimitive(arg3)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
currentElementIndex1 += 1;
if (currentElementIndex1 == length1) {
currentElementIndex1 = 0;
}
currentElementIndex2 += 1;
if (currentElementIndex2 == length2) {
currentElementIndex2 = 0;
}
}
if (length2 == cycles) {
builder.copySomeAttributesFrom(vector2, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length1 == cycles) {
builder.copySomeAttributesFrom(vector1, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tdnbinom(%s, %s, %s, %s)\n\tExpected:\n\tdnbinom(double, integer, double, logical(1))", arg0 .getTypeName(), arg1 .getTypeName(), arg2 .getTypeName(), arg3 .getTypeName()));
}
}
示例14: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0, SEXP arg1, SEXP arg2, SEXP arg3)
throws Exception
{
if (((((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0))))&&((arg1 .length() == 0)||((arg1 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg1)))))&&(arg2 instanceof Vector))&&(arg3 instanceof Vector)) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
Vector vector1 = ((Vector) WrapperRuntime.convertToVector(arg1));
int length1 = vector1 .length();
int currentElementIndex1 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if (length1 == 0) {
return DoubleVector.EMPTY;
}
if (length1 >cycles) {
cycles = length1;
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)||vector1 .isElementNA(currentElementIndex1)) {
builder.setNA(i);
} else {
builder.set(i, Distributions.qexp(vector0 .getElementAsDouble(currentElementIndex0), vector1 .getElementAsDouble(currentElementIndex1), WrapperRuntime.convertToBooleanPrimitive(arg2), WrapperRuntime.convertToBooleanPrimitive(arg3)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
currentElementIndex1 += 1;
if (currentElementIndex1 == length1) {
currentElementIndex1 = 0;
}
}
if (length1 == cycles) {
builder.copySomeAttributesFrom(vector1, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tqexp(%s, %s, %s, %s)\n\tExpected:\n\tqexp(double, double, logical(1), logical(1))", arg0 .getTypeName(), arg1 .getTypeName(), arg2 .getTypeName(), arg3 .getTypeName()));
}
}
示例15: doApply
public static SEXP doApply(Context context, Environment environment, SEXP arg0, SEXP arg1, SEXP arg2)
throws Exception
{
if ((((arg0 .length() == 0)||((arg0 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg0))))&&((arg1 .length() == 0)||((arg1 instanceof Vector)&&DoubleVector.VECTOR_TYPE.isWiderThanOrEqualTo(((Vector) arg1)))))&&(arg2 instanceof Vector)) {
Vector vector0 = ((Vector) WrapperRuntime.convertToVector(arg0));
int length0 = vector0 .length();
int currentElementIndex0 = 0;
Vector vector1 = ((Vector) WrapperRuntime.convertToVector(arg1));
int length1 = vector1 .length();
int currentElementIndex1 = 0;
int cycles = 0;
if (length0 == 0) {
return DoubleVector.EMPTY;
}
if (length0 >cycles) {
cycles = length0;
}
if (length1 == 0) {
return DoubleVector.EMPTY;
}
if (length1 >cycles) {
cycles = length1;
}
org.renjin.sexp.DoubleArrayVector.Builder builder = new org.renjin.sexp.DoubleArrayVector.Builder(cycles);
for (int i = 0; (i!= cycles); i ++) {
if (vector0 .isElementNA(currentElementIndex0)||vector1 .isElementNA(currentElementIndex1)) {
builder.setNA(i);
} else {
builder.set(i, Distributions.dpois(vector0 .getElementAsDouble(currentElementIndex0), vector1 .getElementAsDouble(currentElementIndex1), WrapperRuntime.convertToBooleanPrimitive(arg2)));
}
currentElementIndex0 += 1;
if (currentElementIndex0 == length0) {
currentElementIndex0 = 0;
}
currentElementIndex1 += 1;
if (currentElementIndex1 == length1) {
currentElementIndex1 = 0;
}
}
if (length1 == cycles) {
builder.copySomeAttributesFrom(vector1, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
if (length0 == cycles) {
builder.copySomeAttributesFrom(vector0, Symbols.DIM, Symbols.DIMNAMES, Symbols.NAMES);
}
return builder.build();
} else {
throw new EvalException(String.format("Invalid argument:\n\tdpois(%s, %s, %s)\n\tExpected:\n\tdpois(double, double, logical(1))", arg0 .getTypeName(), arg1 .getTypeName(), arg2 .getTypeName()));
}
}