//vdLn Computation of the natural logarithm of vector elements void klVSLLn(klVector<double>& v,klVector<double>& ans) { const __int64_t n = v.getColumns(); vdLn( n, v.getMemory(),ans.getMemory()); }
/* * Class: com_intel_analytics_bigdl_mkl_MKL * Method: vdLn * Signature: (I[DI[DI)V */ JNIEXPORT void JNICALL Java_com_intel_analytics_bigdl_mkl_MKL_vdLn (JNIEnv * env, jclass cls, jint n, jdoubleArray a, jint aOffset, jdoubleArray y, jint yOffset) { jdouble * jni_a = (*env)->GetPrimitiveArrayCritical(env, a, JNI_FALSE); jdouble * jni_y = (*env)->GetPrimitiveArrayCritical(env, y, JNI_FALSE); vdLn( n, jni_a + aOffset, jni_y + yOffset); (*env)->ReleasePrimitiveArrayCritical(env, y, jni_y, 0); (*env)->ReleasePrimitiveArrayCritical(env, a, jni_a, 0); }
void hard_mkl() { /*char *results_file = "hard_mkl.txt"; FILE *res; if((res=fopen(results_file, "w"))==NULL) { printf("Can't open file %s.\n", results_file); exit(1); }*/ for(int i = 10; i <= ARRAY_SIZE; i*=10) { VSLStreamStatePtr stream; vslNewStream( &stream, VSL_BRNG_MT19937, i*time(0) ); double *ar1, *ar2, *ar3, *ar4, *ar5, *ar6; ar1 = (double *)malloc(i*sizeof(double)); ar2 = (double *)malloc(i*sizeof(double)); ar3 = (double *)malloc(i*sizeof(double)); ar4 = (double *)malloc(i*sizeof(double)); ar5 = (double *)malloc(i*sizeof(double)); ar6 = (double *)malloc(i*sizeof(double)); vdRngGaussian( VSL_RNG_METHOD_GAUSSIAN_BOXMULLER, stream, i, ar1, 1.0, 3.0 ); vdRngGaussian( VSL_RNG_METHOD_GAUSSIAN_BOXMULLER, stream, i, ar2, 1.0, 3.0 ); double start = omp_get_wtime(); for(int j = 0; j < EXPERIMENTS_NUM; j++) { vdCos (i, ar1, ar3); vdLn (i, ar1, ar4); vdPow (i, ar1, ar2, ar5); vdCosh(i, ar2, ar6); } double end = omp_get_wtime(); free(ar1); free(ar2); free(ar3); free(ar4); free(ar5); free(ar6); //fprintf(res, "%lf\n", end-start); printf("%lf, i=%d\n", end-start, i); vslDeleteStream( &stream ); } //fclose(res); }
void caffe_log<double>(const int n, const double* a, double* y) { vdLn(n, a, y); }