-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rs): fix the bug caused by incorrect allocation size of the covar…
…iance matrix
- Loading branch information
1 parent
c1268c4
commit 6698d93
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <stdio.h> | ||
#include <assert.h> | ||
#include "mln_rs.h" | ||
|
||
#define COL 10 | ||
#define ROW 10 | ||
#define K 2 | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
int i, j; | ||
mln_rs_result_t *res, *dres; | ||
uint8_t origin[COL * ROW] = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"; | ||
uint8_t *err[ROW + K] = {0}; | ||
|
||
assert((res = mln_rs_encode(origin, COL, ROW, K)) != NULL); | ||
|
||
printf("res->num=%ld, res->len=%ld\n", res->num, res->len); | ||
|
||
for (i = 0; i < mln_rs_result_get_num(res); ++i) { | ||
err[i] = mln_rs_result_get_data_by_index(res, i); | ||
} | ||
err[0] = NULL; | ||
err[1] = NULL; | ||
|
||
assert((dres = mln_rs_decode(err,COL, ROW, K)) != NULL); | ||
|
||
for (i = 0; i < mln_rs_result_get_num(dres); ++i) { | ||
for (j = 0; j < COL; ++j) { | ||
printf("%c", mln_rs_result_get_data_by_index(dres, i)[j]); | ||
} | ||
printf("\n"); | ||
} | ||
|
||
mln_rs_result_free(res); | ||
mln_rs_result_free(dres); | ||
return 0; | ||
} |