Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

householder fun issue #24

Open
ryfsinphy opened this issue Jul 4, 2024 · 1 comment
Open

householder fun issue #24

ryfsinphy opened this issue Jul 4, 2024 · 1 comment

Comments

@ryfsinphy
Copy link

the householder() function:
else if (fabs(_x->data[0]) <= APPROXIMATELY_ZERO){
_//the w Matrix should copy from _x not point to.., cause w will be released on the end(meanwhile the x will be released as well..);
w = Matrix_copy(_x); //_x;
w = M_numul(w, 1 / M_norm(w, 2));
}
image

image

@645770225
Copy link

645770225 commented Aug 6, 2024

Sorry, because I made a local modification to the implementation of “M_numul”, the return value is a newly applied matrix, so

    if(_x->data[0] > 0){
        w = M_add_sub(1,_x,-1,y);
        M_numul(w,1/M_norm(w, 2));
    }else if (fabs(_x->data[0]) <= _APPROXIMATELY_ZERO_){
        w = _x;
        w = M_numul(w, 1 / M_norm(w, 2));
    }else{
        w = M_add_sub(1,_x,1,y);
        M_numul(w,1/M_norm(w, 2));
    }

should be

     if(_x->data[0] > 0){
        w = M_add_sub(1,_x,-1,y);
        M_numul(w,1/M_norm(w, 2));
    }else if (fabs(_x->data[0]) <= _APPROXIMATELY_ZERO_){
        w = Matrix_copy(_x);
        w = M_numul(w, 1 / M_norm(w, 2));
    }else{
        w = M_add_sub(1,_x,1,y);
        M_numul(w,1/M_norm(w, 2));
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants