-// g++ -std=c++11 -O4 -msse2 -msse3 -msse4 -fopenmp -O3 test_mat2.cpp -o test_mat2 -I /home/couturie/tools/armadillo-6.200.5/include/ -lc -lm -lpthread -lgfortran -DMAX_STACK_ALLOC=2048 -Wall -m64 -DF_INTERFACE_GFORT -fPIC -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=8 -DNO_AFFINITY -UCOMPLEX -DDOUBLE -I/home/couturie/tools/openblas/include -I/home/couturie/Downloads/OpenBLAS-0.2.15/ /home/couturie/tools/openblas/lib/libopenblas_haswellp-r0.2.15.a
-
-
#include <armadillo>
#include <stdlib.h>
Mat<byte> readFullFile(int n, int k, long& sizeFile, int &lc) {
// ifstream stream("lena.png", ios::in | ios::binary | ios::ate);
- ifstream stream("/home/couturie/Downloads/CARCARIASS.zip", ios::in | ios::binary | ios::ate);
-// ifstream stream("lena_small2.png", ios::in | ios::binary | ios::ate);
+ ifstream stream("lena_small2.png", ios::in | ios::binary | ios::ate);
+// ifstream stream("/home/couturie/Downloads/CARCARIASS.zip", ios::in | ios::binary | ios::ate);
+
sizeFile=stream.tellg();
cout<<sizeFile<<endl;
stream.seekg(0, ios::beg);
+
+//Used to convert the size (in long) in 8 bytes
uint8_t mysize[8];
tmpSize>>=8;
}
+//we rebuild the size in order to check that the routine is correct
cout<<"rebuild"<<endl;
long res=0;
for(int i=8-1;i>=0;i--) {
// for(int i=0;i<8;i++)
// contents.insert(i,mysize[i]);
contents.insert (contents.begin(), mysize, mysize+8);
+
+ cout<<"start of the vector"<<endl;
+ for(int i=0;i<8;i++)
+ cout<<(int)contents[i]<<" ";
+ cout<<endl;
+
+
+
cout<<"res contents "<<contents.size()<<endl;
vector<uint8_t> contents2=convert_vec256_to_vec250(contents);
cout<<"res contents2 "<<contents2.size()<<endl;
cout << "success" << endl;
*/
-lc=ceil(contents2.size()/k);
- cout<<lc<<endl;
+ lc=ceil(contents2.size()/k);
+ cout<<"size lc "<<lc<<endl;
Mat<byte> matData(&contents2[0],1,contents2.size());
- int full=0;
int n=8;
int k=4;
- int Tb=64;
- int l=10;//399*Tb;
cout<<"tatat"<<endl;
Mat<byte> C3;
+
+ int off=0;
//read k files among n
- for(int i=0;i<k;i++) {
+
+ int l=0;
+// for(int i=k-1;i>=0;i--) {
+ for(int i=0+off;i<k+off;i++) {
stringstream ss;
ss <<"lena_"<<i<<".png";
string str = ss.str();
-
+ cout<<str<<endl;
Row<byte> d2=readFile(str.c_str());
- C3.insert_rows(i,d2);
+ C3.insert_rows(l,d2);
+ l++;
}
Mat<int> Cs=conv_to<Mat<int>>::from(C3);
cout<<size(Cs)<<" "<<size(C3)<<endl;
+ cout<<"S "<<" "<<S<<endl;
mat Gsi=round(inv(Gs)*det(Gs)*r);
Gsi=mod(Gsi,mm);
- Gsi=mod(Gsi,mm);
cout<<Gsi<<endl;
mat SS2=mod(temp,mm);
Mat<byte> S2=conv_to<Mat<byte>>::from(SS2);
S2=mod(S2,mm);
-// cout<<S2<<endl;
-// cout<<"max"<<endl;
-// cout<<max(S2-S,1)<<endl;
+ cout<<"S2 "<<S2<<endl;
+ cout<<"max"<<endl;
+ cout<<max(S2-S,1)<<endl;
vector<uint8_t> res =conv_to< vector<uint8_t> >::from(S2.row(0));
cout<<"res size "<<res.size()<<endl;
+
+ cout<<"start of file"<<endl;
+ for(int i=0;i<8;i++)
+ cout<<(int)res[i]<<" ";
+ cout<<endl;
+
+
vector<uint8_t> res2=convert_vec250_to_vec256(res);
cout<<"res2 size "<<res2.size()<<endl;