-
Notifications
You must be signed in to change notification settings - Fork 5
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
Update llsp.c #2
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ struct matrix { | |
struct llsp_s { | ||
size_t metrics; // metrics count | ||
double *data; // pointer to the malloc'ed data block, matrix is transposed | ||
struct matrix full; // pointers to the matrix in its original form with all columns | ||
struct matrix full; // pointers to the matrix in its original form with all columns 指向具有所有列的原始形式的矩阵的指针 | ||
struct matrix sort; // matrix with to-be-dropped columns shuffled to the right | ||
struct matrix good; // reduced matrix with low-contribution columns dropped | ||
double last_measured; | ||
|
@@ -56,6 +56,7 @@ llsp_t *llsp_new(size_t count) | |
llsp->metrics = count; | ||
llsp->full.columns = count + 1; | ||
llsp->sort.columns = count + 1; | ||
llsp->good.columns = count + 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is assignment required? |
||
|
||
return llsp; | ||
} | ||
|
@@ -139,8 +140,10 @@ double llsp_predict(llsp_t *restrict llsp, const double *restrict metrics) | |
void llsp_dispose(llsp_t *restrict llsp) | ||
{ | ||
const size_t index_last = llsp->good.columns - 1; | ||
|
||
free(llsp->good.matrix[index_last]); | ||
// fprintf(stderr, "good.matrix = %p, index_last = %lu\n", llsp->good.matrix, index_last); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a comment left from "printf-debugging" now it serves no purpose. Remove it. |
||
if (llsp->good.matrix) { | ||
free(llsp->good.matrix[index_last]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't there be some loop over all columns? Not just the last one? |
||
} | ||
free(llsp->full.matrix); | ||
free(llsp->sort.matrix); | ||
free(llsp->good.matrix); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not put comments in Chinese in a repo that is supposed to be widely accessible.