Skip to content

AMGX_solver_solve_with_0_initial_guess() requires explicit initializing of solution vector #80

Description

@vmasyagin

{
AMGX_matrix_handle A1;
AMGX_vector_handle rhs;
AMGX_vector_handle sln;

        AMGX_matrix_create(&A1, rsrc, AMGX_mode_dDDI);
        AMGX_vector_create(&rhs, rsrc, AMGX_mode_dDDI);
        AMGX_vector_create(&sln, rsrc, AMGX_mode_dDDI);

        double data[] = {1, -2, -3, 1, 1, -4, -5, 1};
        AMGX_pin_memory(data, sizeof(double) * 8);
        int col_ind[] = {0, 1};
        int row_ptr[] = {0, 1, 2};
        AMGX_matrix_upload_all(A1, 2, 2, 2, 2, row_ptr, col_ind, data, 0);
        int nn, block_dimx, block_dimy;
        AMGX_matrix_get_size(A1, &nn, &block_dimx, &block_dimy);
        double data1[] = {1, 2, 3, 4};
        AMGX_pin_memory(data1, sizeof(double) * 4);
        AMGX_vector_upload(rhs, 2, 2, data1);
        int nnn, block_dim;
        AMGX_vector_get_size(rhs, &nnn, &block_dim);
        //AMGX_vector_create(x1, )
        AMGX_solver_create(&solver, rsrc, AMGX_mode_dDDI, config);
        AMGX_solver_setup(solver, A1);
        AMGX_solver_solve_with_0_initial_guess(solver, rhs, sln);
    }

Good afternoon. Please tell me why in this example I get an error of mismatch of dimensions? Purely in blocks everything turns out correctly. I use the solver FGMRES. Maybe there is a working example in which the matrix and vector are initialized from arrays, and not from a file. The documentation seems to be doing everything right.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions