Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
minmingzhu committed Aug 8, 2024
1 parent 7b816df commit accc45b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mllib-dal/src/main/native/oneapi/dal/RowAccessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ JNIEXPORT jdoubleArray JNICALL Java_com_intel_oneapi_dal_table_RowAccessor_cPull
(JNIEnv *env, jobject, jlong cTableAddr, jlong cRowStartIndex, jlong cRowEndIndex,
jint computeDeviceOrdinal){
logger::println(logger::INFO, "RowAccessor PullDouble");
logger::println(logger::INFO, "RowAccessor cRowStartIndex %d", cRowStartIndex);
logger::println(logger::INFO, "RowAccessor cRowEndIndex %d", cRowEndIndex);

homogen_table htable = *reinterpret_cast<const homogen_table *>(cTableAddr);
row_accessor<const double> acc {htable};
jdoubleArray newDoubleArray = nullptr;
Expand All @@ -62,8 +65,21 @@ JNIEXPORT jdoubleArray JNICALL Java_com_intel_oneapi_dal_table_RowAccessor_cPull
return newDoubleArray;
}
}
logger::println(logger::INFO, "RowAccessor get_count %d", row_values.get_count());
newDoubleArray = env->NewDoubleArray(row_values.get_count());
env->SetDoubleArrayRegion(newDoubleArray, 0, row_values.get_count(), row_values.get_data());
logger::println(logger::INFO, "return newDoubleArray");
// Get the length of the jdoubleArray
jsize length = env->GetArrayLength(newDoubleArray);
logger::println(logger::INFO, "newDoubleArray size %d", length);
std::cout << "Values in the jdoubleArray: ";

jdouble buffer[10];
env->GetDoubleArrayRegion(newDoubleArray, 0, row_values.get_count(), buffer);
for (int i = 0; i < arraySize; ++i) {
std::cout << buffer[i] << " ";
}
std::cout << std::endl;
return newDoubleArray;
}

Expand Down

0 comments on commit accc45b

Please sign in to comment.