Open ryfsinphy opened 1 month ago
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));
}
the householder() function: else if (fabs(_x->data[0]) <= _APPROXIMATELYZERO){ _//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;![image](https://github.com/Amoiensis/Matrix_hub/assets/106427653/da9e7270-6605-49a5-94ab-b4966c84b171)
w = M_numul(w, 1 / M_norm(w, 2)); }