我正在尝试在openCL中使用double类型,但无论如何都不起作用,我想使用double来获得更高的精度,如果有任何其他类型的话,请告诉我.
如果你没有时间阅读我的代码,恢复是:我想在openCL中使用double(或其他类型)来更精确地计算pi.
我的代码:
#pragma OPENCL EXTENSION cl_amd_fp64 : enable
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <OpenCL/opencl.h>
////////////////////////////////////////////////////////////////////////////////
// Use a static data size for simplicity
//
#define DATA_SIZE (1000000)
////////////////////////////////////////////////////////////////////////////////
#define TIPO double
// Simple compute kernel that computes the calcpi of an input array. [1]
//
const char *KernelSource = "\n" \
"#pragma OPENCL EXTENSION cl_amd_fp64 : enable \n" \
"__kernel void calcpi( \n" \
" __global double* …
Run Code Online (Sandbox Code Playgroud) 我正在尝试用2个标签做一个tabHost,它没关系,但是我想改变文字大小,我搜索了很多但是我没有找到任何改变所有布局的标签,我只想改变文字大小,而不是改变背景或类似的东西,我像这样添加我的标签:
tabHost.addTab(tabHost.newTabSpec("photos_tab").setIndicator(getString(R.string.userPhotos)).setContent(R.id.tab2));
Run Code Online (Sandbox Code Playgroud)
当我尝试在setIndicator中放置TextView时,我可以更改文本大小但更改所有内容,单击,背景和其他内容..所以我只想更改文本大小.
有任何想法吗?
ps:我没有扩展TabActivity,因此我无法在AndroidManifest中更改Theme或类似的东西.(我之前尝试过:如何在android中更改tabhost的字体大小)
谢谢.
我试图从InputStream调整一个图像的大小,所以我在将图像加载到Bitmap对象时使用Strange内存中的代码问题,但我不知道为什么这个代码总是返回没有图像的Drawable.
这个很好用:
private Drawable decodeFile(InputStream f){
try {
InputStream in2 = new BufferedInputStream(f);
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize=2;
return new BitmapDrawable(BitmapFactory.decodeStream(in2, null, o2));
} catch (Exception e) {
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
这个不起作用:
private Drawable decodeFile(InputStream f){
try {
InputStream in1 = new BufferedInputStream(f);
InputStream in2 = new BufferedInputStream(f);
//Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeStream(in1,null,o);
//The new size we want to scale to
final int IMAGE_MAX_SIZE=90;
//Find …
Run Code Online (Sandbox Code Playgroud)