#include <m4ri/config.h>
#include <stdlib.h>
#include "testing.h"
for (
rci_t i = 0; i < r[0]; ++i){
for (
rci_t j = 0; j < i; ++j)
for (
rci_t j = i + 1; j < n; ++j)
}
for (
rci_t i = r[0]; i < m; ++i)
for (
rci_t j = 0; j < r[0]; ++j)
for (
rci_t i = 0; i < r[0]; ++i){
}
int status = 0;
for (
rci_t i = 0; i < m; ++i)
for (
rci_t j = 0; j < n; ++j){
status = 1;
break;
}
}
return status;
}
printf("pluq: testing full rank m: %5d, n: %5d", m, n);
for (
rci_t i = 0; i < m; ++i){
for (
rci_t j = 0; j < i && j < n;++j)
for (
rci_t j = i + 1; j < m; ++j)
if(i<n)
}
for (
rci_t i = 0; i < m; ++i){
for (
rci_t j = 0; j < i && j < n; ++j)
for (
rci_t j = i + 1; j < n; ++j)
}
for (
rci_t i = 0; i < n && i < m; ++i){
}
int status = 0;
for (
rci_t i = 0; i < m; ++i)
for (
rci_t j=0; j < n; ++j){
status = 1;
}
}
if (status){
printf(" ... FAILED\n");
} else
printf (" ... passed\n");
return status;
}
printf("pluq: testing half rank m: %5d, n: %5d", m, n);
for (
rci_t i = 0; i < m && i < n; ++i) {
for (
rci_t j = 0; j < i;++j)
if (i%2)
for (
rci_t j = i; j < n;++j)
for (
rci_t j = i + 1; j < m; ++j)
}
for (
rci_t i = 0; i < r; ++i) {
for (
rci_t j = 0; j < i; ++j)
for (
rci_t j = i + 1; j < n; ++j)
}
for (
rci_t i = r; i < m; ++i)
for (
rci_t j = 0; j < r;++j)
for (
rci_t i = 0; i < r; ++i){
}
int status = 0;
for (
rci_t i = 0; i < m; ++i) {
for (
rci_t j = 0; j < n; ++j){
status = 1;
}
}
if(status)
break;
}
if (status)
printf(" ... FAILED\n");
else
printf (" ... passed\n");
return status;
}
printf("pluq: testing structured m: %5d, n: %5d", m, n);
for(
rci_t i = 0; i < m; i += 2)
for (
rci_t j = i; j < n; ++j)
int status = check_pluq(A, &r);
printf(", rank: %5d ",r);
if (status) {
printf(" ... FAILED\n");
} else
printf (" ... passed\n");
return status;
}
printf("pluq: testing random m: %5d, n: %5d", m, n);
int status = check_pluq(A, &r);
printf(", rank: %5d ",r);
if (status) {
printf(" ... FAILED\n");
} else
printf (" ... passed\n");
return status;
}
int test_pluq_string(
rci_t m,
rci_t n,
const char *str) {
printf("pluq: testing string m: %5d, n: %5d", m, n);
int status = check_pluq(A, &r);
printf(", rank: %5d ",r);
if (status) {
printf(" ... FAILED\n");
} else
printf (" ... passed\n");
return status;
}
int main() {
int status = 0;
srandom(17);
status += test_pluq_string(4, 4, "0101011100010110");
status += test_pluq_structured(37, 37);
status += test_pluq_structured(63, 63);
status += test_pluq_structured(64, 64);
status += test_pluq_structured(65, 65);
status += test_pluq_structured(128, 128);
status += test_pluq_structured(37, 137);
status += test_pluq_structured(65, 5);
status += test_pluq_structured(128, 18);
status += test_pluq_full_rank(13, 13);
status += test_pluq_full_rank(37, 37);
status += test_pluq_full_rank(63, 63);
status += test_pluq_full_rank(64, 64);
status += test_pluq_full_rank(65, 65);
status += test_pluq_full_rank(97, 97);
status += test_pluq_full_rank(128, 128);
status += test_pluq_full_rank(150, 150);
status += test_pluq_full_rank(256, 256);
status += test_pluq_full_rank(1024, 1024);
status += test_pluq_full_rank(13, 11);
status += test_pluq_full_rank(37, 39);
status += test_pluq_full_rank(64, 164);
status += test_pluq_full_rank(97, 92);
status += test_pluq_full_rank(128, 121);
status += test_pluq_full_rank(150, 153);
status += test_pluq_full_rank(256, 258);
status += test_pluq_full_rank(1024, 1023);
status += test_pluq_half_rank(64, 64);
status += test_pluq_half_rank(65, 65);
status += test_pluq_half_rank(66, 66);
status += test_pluq_half_rank(127, 127);
status += test_pluq_half_rank(129, 129);
status += test_pluq_half_rank(148, 148);
status += test_pluq_half_rank(132, 132);
status += test_pluq_half_rank(256, 256);
status += test_pluq_half_rank(1024, 1024);
status += test_pluq_half_rank(129, 127);
status += test_pluq_half_rank(132, 136);
status += test_pluq_half_rank(256, 251);
status += test_pluq_half_rank(1024, 2100);
status += test_pluq_random(63, 63);
status += test_pluq_random(64, 64);
status += test_pluq_random(65, 65);
status += test_pluq_random(128, 128);
status += test_pluq_random(128, 131);
status += test_pluq_random(132, 731);
status += test_pluq_random(150, 150);
status += test_pluq_random(252, 24);
status += test_pluq_random(256, 256);
status += test_pluq_random(1024, 1022);
status += test_pluq_random(1024, 1024);
status += test_pluq_random(128, 1280);
status += test_pluq_random(128, 130);
status += test_pluq_random(132, 132);
status += test_pluq_random(150, 151);
status += test_pluq_random(252, 2);
status += test_pluq_random(256, 251);
status += test_pluq_random(1024, 1025);
status += test_pluq_random(1024, 1021);
if (!status) {
printf("All tests passed.\n");
return 0;
} else {
return -1;
}
}
mzd_t * mzd_from_str(rci_t m, rci_t n, const char *str)
Create matrix from dense ASCII string.
Definition: io.c:366
Main include file for the M4RI library.
int rci_t
Type of row and column indexes.
Definition: misc.h:72
void mzd_randomize(mzd_t *M)
Fill matrix M with uniformly distributed bits.
Definition: mzd.c:1558
void mzd_free(mzd_t *A)
Free a matrix created with mzd_init.
Definition: mzd.c:271
mzd_t * mzd_copy(mzd_t *DST, mzd_t const *A)
Copy matrix A to DST.
Definition: mzd.c:1655
static void mzd_write_bit(mzd_t *M, rci_t const row, rci_t const col, BIT const value)
Write the bit value to position M[row,col].
Definition: mzd.h:584
static BIT mzd_read_bit(mzd_t const *M, rci_t const row, rci_t const col)
Read the bit at position M[row,col].
Definition: mzd.h:568
mzd_t * mzd_init(rci_t const r, rci_t const c)
Create a new matrix of dimension r x c.
Definition: mzd.c:149
void mzd_apply_p_left(mzd_t *A, mzp_t const *P)
Definition: mzp.c:69
void mzp_free(mzp_t *P)
Definition: mzp.c:37
void mzd_apply_p_right_trans(mzd_t *A, mzp_t const *P)
Definition: mzp.c:304
mzp_t * mzp_init(rci_t length)
Definition: mzp.c:27
rci_t mzd_pluq(mzd_t *A, mzp_t *P, mzp_t *Q, const int cutoff)
PLUQ matrix decomposition.
Definition: ple.c:42
rci_t _mzd_ple_russian(mzd_t *A, mzp_t *P, mzp_t *Q, int k)
PLE matrix decomposition of A using Gray codes.
Definition: ple_russian.c:378
mzd_t * mzd_addmul(mzd_t *C, mzd_t const *A, mzd_t const *B, int cutoff)
Matrix multiplication and in-place addition via the Strassen-Winograd matrix multiplication algorithm...
Definition: strassen.c:668
mzd_t * mzd_mul(mzd_t *C, mzd_t const *A, mzd_t const *B, int cutoff)
Matrix multiplication via the Strassen-Winograd matrix multiplication algorithm, i....
Definition: strassen.c:341
Dense matrices over GF(2).
Definition: mzd.h:86
rci_t nrows
Definition: mzd.h:88
rci_t ncols
Definition: mzd.h:89
Permutations.
Definition: mzp.h:37