- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to get
array h[16]={16,15,14,13,
12,11,10,9,
8,7,6,5,
4,3,2,1,},
but I get an error:
line 41:"status = vsldCorrExec(task, f, f_stride, g, g_stride, h, h_stride);" status is not VSL_STATUS_OK,it is VSL_CC_ERROR_DECIMATION,so how to set the decimation with vslCorrSetDecimation?
If I delete "status = vslCorrSetStart(task, h_start);" in code, it will work normally, and
array h[16]={0,0,0,0,
0,16,15,14,
0,12,11,10,
0,8,7,6}.
What can I do?
#include <assert.h>
#include <mkl.h>
#include <iostream>
using namespace std;
int main()
{
//input
const double f[16] = { 1 , 2 , 3 , 4,
5 , 6 , 7 , 8,
9 , 10, 11, 12,
13, 14, 15, 16,};
//kernel, a simple example
const double g[9] = { 0, 0, 0,
0, 1, 0,
0, 0, 0 };
//output
double h[16] = { 0 };
VSLCorrTaskPtr task;
MKL_INT f_shape[2] = { 4, 4 };
MKL_INT g_shape[2] = { 3, 3 };
MKL_INT h_shape[2] = { 4, 4 };
MKL_INT h_start[2] = { 1, 1 };
MKL_INT f_stride[2] = { f_shape[1], 1 };
MKL_INT g_stride[2] = { g_shape[1], 1 };
MKL_INT h_stride[2] = { h_shape[1], 1 };
int status;
status = vsldCorrNewTask(&task, VSL_CORR_MODE_DIRECT, 2, f_shape, g_shape, h_shape);
assert(status == VSL_STATUS_OK);
status = vslCorrSetStart(task, h_start);
assert(status == VSL_STATUS_OK);
//always get wrong,return -2303(VSL_CC_ERROR_DECIMATION) I can't find and solve the problem
status = vsldCorrExec(task, f, f_stride, g, g_stride, h, h_stride);
assert(status == VSL_STATUS_OK);
status = vslCorrDeleteTask(&task);
assert(status == VSL_STATUS_OK);
//print the result
for (int r = 0; r < 4; r++)
{
cout << r << "(output): ";
for (int c = 0; c < 4; c++)
{
cout << h[r * 4 + c] << " ";
}
cout << endl;
}
return 0;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi caden,
It must belong to the interval Rnmin≤ start(n) ≤ Rnmax. And while you setStart, the Rnmin will be replaced by start(n). And the output(n) should be equals to start(n) + (kn-1) that 1 ≤ kn≤ xshape(n).
In your program, xshape[0]&xshape[1]=4,
=> the Rnmin=-3
If you set size of zshape=4*4, that means you could move from left-top side to right-bottom side by 2 steps, thus, Rnmax=-3+2=-1
int h_start[2]={-3,-3};
And the output should be same as without using SetStart function. If you set zshape to 3*3, that means, -3≤ start(n) ≤0, that Rnmax=0.
Best regards,
Fiona
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fiona Z. (Intel) wrote:
Hi caden,
It must belong to the interval Rnmin≤ start(n) ≤ Rnmax. And while you setStart, the Rnmin will be replaced by start(n). And the output(n) should be equals to start(n) + (kn-1) that 1 ≤ kn≤ xshape(n).
In your program, xshape[0]&xshape[1]=4,
=> the Rnmin=-3If you set size of zshape=4*4, that means you could move from left-top side to right-bottom side by 2 steps, thus, Rnmax=-3+2=-1
int h_start[2]={-3,-3};
And the output should be same as without using SetStart function. If you set zshape to 3*3, that means, -3≤ start(n) ≤0, that Rnmax=0.
Best regards,
Fiona
thank you,Fiona.
According to your suggestion,I solve this problem.But if I write "int h_start[2]={-3,-3};",the result is wrong,too.
the array h[16] is {0,0,0,0,
0,16,15,14,
0,12,11,10,
0,8,7,6}.
Instead of
int h_start[2]={-2,-2};
then it will be right, the array h[16] is
{16,15,14,13,
12,11,10,9,
8,7,6,5,
4,3,2,1,},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi caden,
I just thought you want to print left-top corner of result matrix. The scale of start(n) is between -3~-1 in this program, if you set start(n) out of range. There will be an error. Anyway, you could fix program and get result what you want.
Best regards,
Fiona
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page