- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Hi,
Could you check the following example?
void test_mkl_dcsrmv()
{
// |1 1||0|=|1|
// |0 1||1| |1|
int size = 2;
double one = 1.0;
double entries[] = {1.0, 1.0, 1.0};
int adjncy[] = {0, 1, 1};
int pntrb[] = {0, 2};
int pntre[] = {1, 2};
double x[] = {0.0, 1.0};
double y[] = {0.0, 0.0};
// y = alpha*A*x + beta*y
mkl_dcsrmv("N", &size, &size, &one, "G**C", entries, adjncy, pntrb, pntre,
x, &one, y);
std::cout << "y=[" << y[0] << "," << y[1] << "]\n";
// Should print "y=[1,1]". Right?
}
As a matter of fact, it prints "y=[0,0]". Why????
Thanks!
Could you check the following example?
void test_mkl_dcsrmv()
{
// |1 1||0|=|1|
// |0 1||1| |1|
int size = 2;
double one = 1.0;
double entries[] = {1.0, 1.0, 1.0};
int adjncy[] = {0, 1, 1};
int pntrb[] = {0, 2};
int pntre[] = {1, 2};
double x[] = {0.0, 1.0};
double y[] = {0.0, 0.0};
// y = alpha*A*x + beta*y
mkl_dcsrmv("N", &size, &size, &one, "G**C", entries, adjncy, pntrb, pntre,
x, &one, y);
std::cout << "y=[" << y[0] << "," << y[1] << "]\n";
// Should print "y=[1,1]". Right?
}
As a matter of fact, it prints "y=[0,0]". Why????
Thanks!
Link copiado
2 Respostas
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Quoting - agnonchik
Hi,
Could you check the following example?
void test_mkl_dcsrmv()
{
// |1 1||0|=|1|
// |0 1||1| |1|
int size = 2;
double one = 1.0;
double entries[] = {1.0, 1.0, 1.0};
int adjncy[] = {0, 1, 1};
int pntrb[] = {0, 2};
int pntre[] = {1, 2};
double x[] = {0.0, 1.0};
double y[] = {0.0, 0.0};
// y = alpha*A*x + beta*y
mkl_dcsrmv("N", &size, &size, &one, "G**C", entries, adjncy, pntrb, pntre,
x, &one, y);
std::cout << "y=[" << y[0] << "," << y[1] << "]n";
// Should print "y=[1,1]". Right?
}
As a matter of fact, it prints "y=[0,0]". Why????
Thanks!
Could you check the following example?
void test_mkl_dcsrmv()
{
// |1 1||0|=|1|
// |0 1||1| |1|
int size = 2;
double one = 1.0;
double entries[] = {1.0, 1.0, 1.0};
int adjncy[] = {0, 1, 1};
int pntrb[] = {0, 2};
int pntre[] = {1, 2};
double x[] = {0.0, 1.0};
double y[] = {0.0, 0.0};
// y = alpha*A*x + beta*y
mkl_dcsrmv("N", &size, &size, &one, "G**C", entries, adjncy, pntrb, pntre,
x, &one, y);
std::cout << "y=[" << y[0] << "," << y[1] << "]n";
// Should print "y=[1,1]". Right?
}
As a matter of fact, it prints "y=[0,0]". Why????
Thanks!
The representation ofyour matrix in CSR fromat is not correct in your program. In your case, the values of thearray pntre must be
int pntre[] = {2, 3};
intead of your setting
int pntre[] = {1, 2};
If we replace the values of pntre by {2, 3 }, we get y=[1,1] as it should be.
All the best
Sergey
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Thanks, Sergey!
Now it works.
Now it works.

Responder
Opções do tópico
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora