implementing some new functionality to bitvecotr

This commit is contained in:
2023-12-27 23:24:13 +01:00
parent eafcfbdd00
commit c428d4650c
5 changed files with 111 additions and 16 deletions

27
t.cc
View File

@@ -2784,7 +2784,7 @@ NRSMat<char> adjperm = adj.permuted(p);
cout <<"resorted graph = "<<adjperm<<endl;
}
if(1)
if(0)
{
int seed;
int f=open("/dev/random",O_RDONLY);
@@ -2852,4 +2852,29 @@ cout <<endl<<"Inverse via svd\n"<<ainv2<<endl;
cout <<"Difference of inverses = "<<(ainv-ainv2).norm()<<endl;
}
if(1)
{
int seed;
int f=open("/dev/random",O_RDONLY);
if(sizeof(int)!=read(f,&seed,sizeof(int))) laerror("cannot read /dev/random");
close(f);
srand(seed);
int n;
cin >>n;
bitvector v(n);
v.randomize();
//do{
// cout <<v <<endl;
// v>>=1;
//}while(!v.iszero());
for(int i=0; i<n; ++i)
{
cout <<v <<endl;
v<<=1;
}
}
}