Commit ccfbe46b authored by MIJIEUX Thomas's avatar MIJIEUX Thomas

coding style: remove whitespaces before semicolons

parent 6885eb5b
......@@ -103,7 +103,7 @@ public:
void* inTolerance, int nbTol) override
{
P* inCastTol = (reinterpret_cast<P*>(inTolerance));
for (int i=0 ; i<nbTol ; ++i)
for (int i=0; i<nbTol; ++i)
tolerance.push_back(inCastTol[i]);
max_iter = inMaxIte;
restart = inRestart;
......
......@@ -76,7 +76,7 @@ struct Arnoldi {
newK = DeflatedRestart(base,DR.hessSave,R1,DR.k,DR.LS);
//Init hess with Hess Storage
for (int i=0 ; i<newK ; ++i) {
for (int i=0; i<newK; ++i) {
memcpy(&hess.getPtr()[i*hess.getLeadingDim()],
&DR.hessSave.getPtr()[i*DR.hessSave.getLeadingDim()],
(newK+SizeBlock)*sizeof(Scalar));
......@@ -88,8 +88,8 @@ struct Arnoldi {
R0.initData(SizeBlock,dim);
//Fill matrix R0 with each vector r0_i = B[i] - A * X0[i]
A.MatBlockVect(X0,R0); // R0 = A*X0
for (int i=0 ; i<SizeBlock ; ++i) // R0 = B - R0
for (int j=0 ; j<dim ; ++j)
for (int i=0; i<SizeBlock; ++i) // R0 = B - R0
for (int j=0; j<dim; ++j)
R0.getPtr(i)[j] = B.getPtr(i)[j] - R0.getPtr(i)[j];
std::pair<Primary,Primary> minmaxR0 = R0.getMinMaxNorm(A);
......@@ -175,8 +175,8 @@ struct Arnoldi {
} else {//No pre Cond used
base.ComputeProduct(Yj,Sol);
}
for (int i=0 ; i<SizeBlock ; ++i)
for (int k=0 ; k<dim ; ++k)
for (int i=0; i<SizeBlock; ++i)
for (int k=0; k<dim; ++k)
X0.getPtr(i)[k] += Sol.getPtr(i)[k];
//Check if Arnoldi residual is different from real
//residual, if so, cold Restart
......
......@@ -80,8 +80,8 @@ struct Arnoldi_IB
Block<Scalar,Primary,KI> R0(SizeBlock,dim);
//Fill matrix R0 with each vector r0_i = B[i] - A * X0[i]
A.MatBlockVect(X0,R0); // R0 = A*X0
for (int i=0 ; i<SizeBlock ; ++i) // R0 = B - R0
for (int k=0 ; k<dim ; ++k)
for (int i=0; i<SizeBlock; ++i) // R0 = B - R0
for (int k=0; k<dim; ++k)
R0.getPtr(i)[k] = B.getPtr(i)[k] - R0.getPtr(i)[k];
Block<Scalar,Primary,KI> q0(SizeBlock,dim);
Block<Scalar,Primary,KI> r0(SizeBlock,SizeBlock);
......@@ -299,8 +299,8 @@ struct Arnoldi_IB
} else {//No pre Cond used
base.ComputeProduct(Y,Sol);
}
for (int i=0 ; i<SizeBlock ; ++i) {
for (int k=0 ; k<dim ; ++k) {
for (int i=0; i<SizeBlock; ++i) {
for (int k=0; k<dim; ++k) {
X0.getPtr(i)[k] += Sol.getPtr(i)[k];
}
}
......
This diff is collapsed.
......@@ -67,8 +67,8 @@ struct Arnoldi_QRInc{
Block<Scalar,Primary,KI> R0(SizeBlock,dim);
//Fill matrix R0 with each vector r0_i = B[i] - A * X0[i]
A.MatBlockVect(X0,R0); //R0 = A*X0
for (int i=0 ; i<SizeBlock ; ++i) { //R0 = B - R0
for (int j=0 ; j<dim ; ++j) {
for (int i=0; i<SizeBlock; ++i) { //R0 = B - R0
for (int j=0; j<dim; ++j) {
R0.getPtr(i)[j] = B.getPtr(i)[j] - R0.getPtr(i)[j];
}
}
......@@ -155,8 +155,8 @@ struct Arnoldi_QRInc{
} else {//No pre Cond used
base.ComputeProduct(Yj,Sol);
}
for (int i=0 ; i<SizeBlock ; ++i) {
for (int k=0 ; k<dim ; ++k) {
for (int i=0; i<SizeBlock; ++i) {
for (int k=0; k<dim; ++k) {
X0.getPtr(i)[k] += Sol.getPtr(i)[k];
}
}
......
......@@ -277,7 +277,7 @@ public:
Scalar * ptrOfHess = HessToWrite;
int nbColinWj = Wj.getSizeBlock() - idxToStart;
//Loop over different blocks
for (int i=0 ; i< currentBlockUsed ; ++i) {
for (int i=0; i< currentBlockUsed; ++i) {
int sizeCurrBlock = sumNbVectInBlock[i+1]-sumNbVectInBlock[i];
//Compute hessenberg coeff
......@@ -328,7 +328,7 @@ public:
Scalar * ptrOfHess = HessToWrite;
int nbColinWj = Wj.getSizeBlock() - idxToStart;
//Loop over different blocks
for (int i=0 ; i< currentBlockUsed ; ++i) {
for (int i=0; i< currentBlockUsed; ++i) {
int sizeCurrBlock = sumNbVectInBlock[i+1]-sumNbVectInBlock[i];
//Create temp block
......@@ -349,8 +349,8 @@ public:
Scalar(-1), Scalar(1));
//Add temp to hess
for (int i=0 ; i<temp.getSizeBlock() ; ++i)
for (int j=0 ; j<temp.getLeadingDim() ; ++j)
for (int i=0; i<temp.getSizeBlock(); ++i)
for (int j=0; j<temp.getLeadingDim(); ++j)
ptrOfHess[i*ldHess+j] += temp.getPtr(i)[j];
ptrOfHess += sizeCurrBlock;
}
......@@ -408,8 +408,8 @@ public:
Wj.getPtr(idxToStart), Wj.getLeadingDim(),
Scalar(-1), Scalar(1));
//Add temp to hess
for (int i=0 ; i<temp.getSizeBlock() ; ++i)
for (int j=0 ; j<temp.getLeadingDim() ; ++j)
for (int i=0; i<temp.getSizeBlock(); ++i)
for (int j=0; j<temp.getLeadingDim(); ++j)
HessToWrite[i*ldHess+j] += temp.getPtr(i)[j];
}
......@@ -435,9 +435,9 @@ public:
void displayBase(std::string name = "")
{
std::cout<<name<<"\t"<<"currentBlockUsed "<<currentBlockUsed<<"\n";
for (int i = 0 ; i< sumNbVectInBlock[currentBlockUsed] ; ++i) {
for (int i = 0; i< sumNbVectInBlock[currentBlockUsed]; ++i) {
std::cout<<"["<<i<<"] ";
for (int j=0 ; j< getLeadingDim() ; ++j) {
for (int j=0; j< getLeadingDim(); ++j) {
std::cout<<datas[i*ldBase+j]<<"\t";
}
std::cout<<"\n";
......@@ -454,7 +454,7 @@ public:
A.getPtr(),A.getLeadingDim(),Scalar(1),Scalar(0));
//Before printing A, we substract Identity, in order to see
//more efficiently the deviation from it
for (int i=0 ; i<nbVect ; ++i)
for (int i=0; i<nbVect; ++i)
A.getPtr(i)[i] -= Scalar(1);
std::cout<<"Base*Base^{H} is "<<nbVect<<" x "<<nbVect<<"\n";
......
......@@ -115,9 +115,9 @@ public:
{
std::cout<<name<<"\t LeadingDim x SizeBlock : "<<getLeadingDim()
<<" x "<<getSizeBlock()<<"\n";
for (int a=0 ; a<ldb ; ++a) {
for (int a=0; a<ldb; ++a) {
std::cout<<"["<<a<<"] ";
for (int b=0 ; b<getSizeBlock() ; ++b) {
for (int b=0; b<getSizeBlock(); ++b) {
std::cout<<datas[b*ldb+a]<<"\t";
}
std::cout<<std::endl;
......@@ -181,7 +181,7 @@ public:
//Copy triangular R part inside input R
if (R.getSizeBlock() != 0) { //R isn't allocated, then we don't
//copy inside
for (int i=0; i<sizeQrBlock ; ++i)
for (int i=0; i<sizeQrBlock; ++i)
memcpy(R.getPtr(i),&datas[(vStart+i)*ldb+hStart],(i+1)*sizeof(Scalar));
}
......@@ -197,7 +197,7 @@ public:
//First copy inside Q because current block does not have
//necessary space for a full QR facto
/*
for (int i=0 ; i<sizeQrBlock ; ++i) {
for (int i=0; i<sizeQrBlock; ++i) {
memcpy(Q.getPtr(i),&datas[hStart+(vStart+i)*ldb],
(ldb-hStart)*sizeof(Scalar));
}
......@@ -235,23 +235,23 @@ public:
int m = getSizeBlock();
//Assuming Q is at least n lines for m col and R is m x m
for (int i=0 ; i<m ; ++i) {
for (int i=0; i<m; ++i) {
Block<Scalar,Primary,KI> tempW{1,n};
memcpy(tempW.getPtr(), getPtr(i), n*sizeof(Scalar));
for (int j=0 ; j < i ; ++j) {
for (int j=0; j < i; ++j) {
//dot = transp(Q(:,j)) * w
Scalar dot;
A.DotProduct(n,1,Q.getPtr(j),tempW.getPtr(),&dot);
//w = w - dot.Q(:,j)
for (int t=0 ; t<n ; ++t)
for (int t=0; t<n; ++t)
tempW.getPtr()[t] -= dot*Q.getPtr(j)[t];
R.getPtr(i)[j] = dot;
}
auto norm = tempW.getNorm(0,A);
R.getPtr(i)[i] = norm;
for (int k=0 ; k<n ;++k)
for (int k=0; k<n;++k)
Q.getPtr(i)[k] = tempW.getPtr()[k]/norm;
}
}
......@@ -265,7 +265,7 @@ public:
//Starting point
Scalar * vect = getPtr(id);
auto norm = module<Scalar,Primary>(vect[0]);
for (int i=1 ; i<getLeadingDim() ; ++i) {
for (int i=1; i<getLeadingDim(); ++i) {
norm+=module<Scalar,Primary>(vect[i]);
}
auto norm2 = std::sqrt(norm);
......@@ -297,7 +297,7 @@ public:
std::pair<Primary,Primary> getMinMaxNorm(Matrix& A)
{
std::pair<Primary,Primary> minmax{std::numeric_limits<Primary>::max(),0};
for (int i=0 ; i<SizeBlock ; ++i) {
for (int i=0; i<SizeBlock; ++i) {
Primary norm = getNorm<Matrix>(i,A);
if (norm > minmax.second)
minmax.second = norm;
......@@ -314,7 +314,7 @@ public:
std::pair<Primary,Primary> getMinMaxNorm()
{
std::pair<Primary,Primary> minmax{std::numeric_limits<Primary>::max(),0};
for (int i=0 ; i<SizeBlock ; ++i) {
for (int i=0; i<SizeBlock; ++i) {
Primary norm = getNorm(i);
if (norm > minmax.second)
minmax.second = norm;
......@@ -363,7 +363,7 @@ public:
*/
bool CheckMultiPrecision(std::vector<Primary>& epsilon)
{
for (int i=0 ; i<SizeBlock ; ++i) {
for (int i=0; i<SizeBlock; ++i) {
if (getNorm(i) > epsilon[i])
return false;
}
......@@ -377,7 +377,7 @@ public:
template<class Matrix>
bool CheckMultiPrecision(std::vector<Primary>& epsilon,Matrix & A)
{
for (int i=0 ; i<SizeBlock ; ++i) {
for (int i=0; i<SizeBlock; ++i) {
if (getNorm(i,A) > epsilon[i])
return false;
}
......@@ -391,10 +391,10 @@ public:
*/
void Normalize(std::vector<Primary>& norms)
{
for (int i=0 ; i< SizeBlock ; ++i) {
for (int i=0; i< SizeBlock; ++i) {
Primary currNorm = getNorm(i);
norms.push_back(currNorm);
for (int j=0 ; j< getLeadingDim() ; ++j) {
for (int j=0; j< getLeadingDim(); ++j) {
getPtr(i)[j] /= currNorm;
}
}
......@@ -407,10 +407,10 @@ public:
template<class Matrix>
void Normalize(std::vector<Primary>& norms, Matrix& A)
{
for (int i=0 ; i< SizeBlock ; ++i) {
for (int i=0; i< SizeBlock; ++i) {
Primary currNorm = getNorm(i,A);
norms.push_back(currNorm);
for (int j=0 ; j< getLeadingDim() ; ++j)
for (int j=0; j< getLeadingDim(); ++j)
getPtr(i)[j] /= currNorm;
}
}
......@@ -421,8 +421,8 @@ public:
*/
void ScaleBlock(std::vector<Primary>& coeffs)
{
for (int i=0 ; i< SizeBlock ; ++i)
for (int j=0 ; j< getLeadingDim() ; ++j)
for (int i=0; i< SizeBlock; ++i)
for (int j=0; j< getLeadingDim(); ++j)
getPtr(i)[j] *= coeffs[i];
}
......@@ -441,7 +441,7 @@ public:
<<" and current block\n";
exit(0);
}
for (int i=0 ; i<SizeBlock ; ++i) {
for (int i=0; i<SizeBlock; ++i) {
memcpy(getPtr(i),in.getPtr(i),sizeof(Scalar)*ldb);
}
}
......
......@@ -82,7 +82,7 @@ public:
std::cout<<"Problem on QR facto\n";
//2 - get the R part and write it in input
for (int i=0 ; i<getSizeW() ; ++i) {
for (int i=0; i<getSizeW(); ++i) {
memcpy(&toWriteR[i*ldR],&getW()[i*ld],
(i+1)*sizeof(Scalar));
}
......
......@@ -656,7 +656,7 @@ int ChameleonKernI::trtrs(int n,int nrhs,std::complex<double>* A,int lda,
// //i..
// std::complex<float> J{0,1};
// //Copy back inside alpha
// for (int i=0 ; i<n ; ++i) {
// for (int i=0; i<n; ++i) {
// alpha[i] = alphar[i] + J * alphai[i];
// }
......@@ -695,7 +695,7 @@ int ChameleonKernI::trtrs(int n,int nrhs,std::complex<double>* A,int lda,
// //i..
// std::complex<double> J{0,1};
// //Copy back inside alpha
// for (int i=0 ; i<n ; ++i) {
// for (int i=0; i<n; ++i) {
// alpha[i] = alphar[i] + J * alphai[i];
// }
......
......@@ -60,8 +60,8 @@ int DeflatedRestart(Base<Scalar,Primary,KI>& base, HessStorage<Scalar>& hessSave
Scalar(1),Scalar(0));
//B <- Hm^{h}
for (int i=0 ; i<nm ; ++i) {
for (int j=0 ; j<nm ; ++j) {
for (int i=0; i<nm; ++i) {
for (int j=0; j<nm; ++j) {
B.getPtr(i)[j] = std::conj(hessSave.getPtr()[j*ldh + i]);
}
}
......@@ -91,7 +91,7 @@ int DeflatedRestart(Base<Scalar,Primary,KI>& base, HessStorage<Scalar>& hessSave
int newK = ind.size();
for (int i=0 ; i< newK ; ++i) {
for (int i=0; i< newK; ++i) {
std::cout<<"i="<<i<<" : index="<<ind[i]<<" : eigen val : "
<<alpha.getPtr(0)[ind[i]]/beta.getPtr(0)[ind[i]]<<"\n";
}
......@@ -100,12 +100,12 @@ int DeflatedRestart(Base<Scalar,Primary,KI>& base, HessStorage<Scalar>& hessSave
Block<Scalar,Primary,KI> G{newK+p,nm+p};
//Copy last residual inside right part of G
for (int i=0 ; i<p ; ++i) {
for (int i=0; i<p; ++i) {
memcpy(G.getPtr(newK+i),LS.getPtr(i),(nm+p)*sizeof(Scalar));
}
//Copy back the corresponding vectors inside G.
for (int i=0 ; i<newK ; ++i) {
for (int i=0; i<newK; ++i) {
memcpy(G.getPtr(i),vr.getPtr(ind[i]),sizeof(Scalar)*nm);
}
......@@ -120,7 +120,7 @@ int DeflatedRestart(Base<Scalar,Primary,KI>& base, HessStorage<Scalar>& hessSave
//Copy last columns of R inside outRHS
for (int i=0 ; i<p ; ++i) {
for (int i=0; i<p; ++i) {
memcpy(outRHS.getPtr(i),
R.getPtr(i + newK),
sizeof(Scalar) * (newK+p));
......
......@@ -54,10 +54,10 @@ void GetKIndexesComplex(Block<std::complex<Primary>,Primary> & alpha,
std::cout<<"GetKIndexesComplex\n";
using Complx = std::complex<Primary>;
for (int i=0 ; i<k ; ++i) {
for (int i=0; i<k; ++i) {
Primary min = std::numeric_limits<Primary>::max();
int last_ind_found = -1;
for (int j=0 ; j< alpha.getLeadingDim() ; ++j) {
for (int j=0; j< alpha.getLeadingDim(); ++j) {
//Check if already found
if (std::find_if (ind.begin(), ind.end(),
[j](const int& a) -> bool
......@@ -92,10 +92,10 @@ void GetKIndexesReal(Block<std::complex<Primary>,Primary> & alpha,
std::cout<<"GetKIndexesReal\n";
using Complx = std::complex<Primary>;
for (int i=0 ; i<k ; ++i) {
for (int i=0; i<k; ++i) {
Primary min = std::numeric_limits<Primary>::max();
int last_ind_found = -1;
for (int j=0 ; j< alpha.getLeadingDim() ; ++j) {
for (int j=0; j< alpha.getLeadingDim(); ++j) {
//Check if already found
if (std::find_if (ind.begin(), ind.end(),
[j](const int& a) -> bool
......@@ -187,7 +187,7 @@ void CheckEigenResults(Block<Scalar,Primary,KI>& A,
{
int dim = A.getLeadingDim();
Block<Scalar,Primary,KI> res{dim,dim};
for (int i=0 ; i< dim ; i++) {
for (int i=0; i< dim; i++) {
Scalar theta_i = alpha.getPtr()[i]/beta.getPtr()[i];
//res_i = A*vr_i
KI::gemm(dim,1,dim,
......
......@@ -89,7 +89,7 @@ public:
if (!Phi) {
Phi = new Block<Scalar,Primary,KI>{Lambda1->getSizeBlock(),
Lambda1->getSizeBlock() + p1};
for (int i=0 ; i<Lambda1->getSizeBlock() ; ++i) {
for (int i=0; i<Lambda1->getSizeBlock(); ++i) {
Phi->getPtr(i)[i] = Scalar(1);
}
} else {
......@@ -112,8 +112,8 @@ public:
void displayHessExtended(std::string name = "") {
std::cout<<name<<"\n";
for (int i=0 ; i<sumNbVectInBlck.back() ; ++i) {
for (int j=0 ; j<nbLineUsed+Parent::getSizeBlock() ; ++j) {
for (int i=0; i<sumNbVectInBlck.back(); ++i) {
for (int j=0; j<nbLineUsed+Parent::getSizeBlock(); ++j) {
std::cout<<Parent::getPtr()[i*Parent::getLeadingDim()+j]<<"\t";
}
std::cout<<std::endl;
......@@ -123,10 +123,10 @@ public:
void displayHessExtendedBitMap(std::string name = "") {
std::cout<<name<<"\n";
for (int j=0 ; j<nbLineUsed+Parent::getSizeBlock() ; ++j) {
for (int j=0; j<nbLineUsed+Parent::getSizeBlock(); ++j) {
int col = 0;
for (unsigned int i=0 ; i<nbVectInBlck.size() ; ++i) {
for (int t=0; t<nbVectInBlck[i] ; ++t) {
for (unsigned int i=0; i<nbVectInBlck.size(); ++i) {
for (int t=0; t<nbVectInBlck[i]; ++t) {
if (module<Scalar,Primary>(Parent::getPtr()[col*Parent::getLeadingDim()+j]) != Primary(0)) {
std::cout<<"."<<" ";
} else {
......@@ -182,7 +182,7 @@ public:
int nj = sumNbVectInBlck.back();
//Save H in order to write directly inside L
Block<Scalar,Primary,KI> Hj(nj,Parent::getSizeBlock());
for (int i=0 ; i<nj ; i++) { //Copy H part inside Block Hj
for (int i=0; i<nj; i++) { //Copy H part inside Block Hj
memcpy(Hj.getPtr(i),&getPtrToG()[i*Parent::getLeadingDim()],
sizeof(Scalar)* Parent::getSizeBlock());
}
......@@ -212,7 +212,7 @@ public:
Phi->getLeadingDim() + p_jplus1};
//Init first n_j rows
for (int i=0 ; i<Parent::getSizeBlock() ; ++i) {
for (int i=0; i<Parent::getSizeBlock(); ++i) {
memcpy(newPhi->getPtr(i),Phi->getPtr(i),
nj*sizeof(Scalar));
}
......@@ -257,7 +257,7 @@ public:
Scalar * r = new Scalar[ldR*Parent::getSizeBlock()];
memset(r,0,ldR*Parent::getSizeBlock()*sizeof(Scalar));
if (!Phi) {
for (int i=0 ; i<Parent::getSizeBlock() ; ++i) {
for (int i=0; i<Parent::getSizeBlock(); ++i) {
memcpy(&r[i*ldR],Lambda1->getPtr(i),
sizeof(Scalar)*(i+1));
}
......@@ -266,8 +266,8 @@ public:
}
Block<Scalar,Primary,KI> RHS{Parent::getSizeBlock(),outputResidual.getLeadingDim()};
for (int i=0 ; i<outputResidual.getSizeBlock();++i) {
for (int j=0 ; j<outputResidual.getLeadingDim() ; ++j) {
for (int i=0; i<outputResidual.getSizeBlock();++i) {
for (int j=0; j<outputResidual.getLeadingDim(); ++j) {
RHS.getPtr(i)[j] = r[i*ldR+j];
}
}
......@@ -277,7 +277,7 @@ public:
//displayHessExtended("Same");
Scalar*workingCopy = new Scalar[ldR*sumNbVectInBlck.back()];
memset(workingCopy,0,ldR*sumNbVectInBlck.back()*sizeof(Scalar));
for (int i=0 ; i<sumNbVectInBlck.back() ; ++i) {
for (int i=0; i<sumNbVectInBlck.back(); ++i) {
memcpy(&workingCopy[i*ldR],&Parent::getPtr()[i*Parent::getLeadingDim()],
sizeof(Scalar)*ldR);
}
......@@ -294,7 +294,7 @@ public:
std::cout<<"Problem on Least Square\n\t gels="<<gels<<"\n";
}
//Copy back res inside Y
for (int i=0 ; i<Parent::getSizeBlock() ; ++i) {
for (int i=0; i<Parent::getSizeBlock(); ++i) {
memcpy(outputY.getPtr(i),&r[i*ldR],sizeof(Scalar)*sumNbVectInBlck.back());
}
......@@ -309,8 +309,8 @@ public:
std::cout<<"Compute F*Y done\n";
//Add gamma to residual
for (int i=0 ; i<outputResidual.getSizeBlock();++i) {
for (int j=0 ; j<outputResidual.getLeadingDim() ; ++j) {
for (int i=0; i<outputResidual.getSizeBlock();++i) {
for (int j=0; j<outputResidual.getLeadingDim(); ++j) {
outputResidual.getPtr(i)[j] -= RHS.getPtr(i)[j];
}
}
......
......@@ -94,8 +94,8 @@ public:
void displayHess(std::string name = "") {
std::cout<<name<<"^{H}\t"<<"Current Size "<<idxCurrBlock<<"\n";
for (int j=0; j<(idxCurrBlock+1)*Parent::getSizeBlock() ; ++j) {
for (int i=0 ; i<idxCurrBlock*Parent::getSizeBlock() ; ++i) {
for (int j=0; j<(idxCurrBlock+1)*Parent::getSizeBlock(); ++j) {
for (int i=0; i<idxCurrBlock*Parent::getSizeBlock(); ++i) {
std::cout<<getPtr()[i*Parent::getLeadingDim()+j]<<"\t";
}
std::cout<<"\n";
......@@ -104,9 +104,9 @@ public:
void displayHessAndRHS(std::string name = "") {
std::cout<<name<<"\t"<<"Current Size "<<idxCurrBlock<<"\n";
for (int j=0 ; j< (idxCurrBlock+1)*Parent::getSizeBlock() ; ++j) {
for (int i=0 ; i< (idxCurrBlock) ; ++i) {
for (int k=0; k<Parent::getSizeBlock() ; ++k) {
for (int j=0; j< (idxCurrBlock+1)*Parent::getSizeBlock(); ++j) {
for (int i=0; i< (idxCurrBlock); ++i) {
for (int k=0; k<Parent::getSizeBlock(); ++k) {
int curr_ind = (i*Parent::getSizeBlock()+k)*Parent::getLeadingDim()+j;
if (module<Scalar,Primary>(Parent::getPtr()[curr_ind]) != Primary(0)) {
std::cout<<"."<<" ";
......@@ -119,7 +119,7 @@ public:
std::cout<<std::endl;
}
std::cout<<std::endl<<"RHS :: ";
//for (int i=0 ; i<)
//for (int i=0; i<)
}
/**
......@@ -127,8 +127,8 @@ public:
*/
void displayRHS() {
std::cout<<"RHS step "<<idxCurrBlock<<"\n";
for (int i=0 ; i<ldRHS ; ++i) {
for (int j=0 ; j<Parent::getSizeBlock() ; ++j) {
for (int i=0; i<ldRHS; ++i) {
for (int j=0; j<Parent::getSizeBlock(); ++j) {
std::cout<<RHS[j*ldRHS+i]<<" ";
}
std::cout<<std::endl;
......@@ -142,7 +142,7 @@ public:
*
*/
void initRHS(Block<Scalar,Primary,KI>& Gamma) {
for (int i=0 ; i<Parent::getSizeBlock() ; ++i) {
for (int i=0; i<Parent::getSizeBlock(); ++i) {
memcpy(getRHS(i),Gamma.getPtr(i),sizeof(Scalar)*Parent::getSizeBlock());
}
}
......@@ -153,7 +153,7 @@ public:
//Get the ptr where we currently are
Scalar * toWrite = getPtr(idxCurrBlock-1) +
Parent::getSizeBlock()*(idxCurrBlock);
for (int i=0 ; i<Parent::getSizeBlock() ; ++i) {
for (int i=0; i<Parent::getSizeBlock(); ++i) {
memcpy(&toWrite[i*Parent::getLeadingDim()],
R.getPtr(i),Parent::getSizeBlock()*sizeof(Scalar));
}
......@@ -198,7 +198,7 @@ public:
//-1 Loop over each block in last colomn to apply Householders
//-already computed.
for (int i=0 ; i<(idxCurrBlock-1) ; ++i) {
for (int i=0; i<(idxCurrBlock-1); ++i) {
Scalar *hRefl = getHouseRefl(i);
Scalar *colB = getBlockCol(i);
int ormqrf = KI::ormqr(
......@@ -249,11 +249,11 @@ public:
std::tuple<Primary,Primary,bool> CheckRes(std::vector<Primary> & epsilon) {
std::tuple<Primary,Primary,bool> minmax =
std::make_tuple(Primary(100000),Primary(0),true);
for (int i=0 ; i< Parent::getSizeBlock() ; ++i) {
for (int i=0; i< Parent::getSizeBlock(); ++i) {
//Block evaluated is last block filled of RHS
Scalar * start = getRHS(i) + (idxCurrBlock)*Parent::getSizeBlock();
Primary acc = Primary(0);
for (int j=0 ; j<Parent::getSizeBlock() ; ++j) {
for (int j=0; j<Parent::getSizeBlock(); ++j) {
acc += module<Scalar,Primary>(start[j]);
}
Primary norm = std::sqrt(acc);
......@@ -288,7 +288,7 @@ public:
//First, copy inside Y what's in RHS, and then copy it inside
//blockRes too
for (int i=0 ; i<Parent::getSizeBlock() ; ++i) {
for (int i=0; i<Parent::getSizeBlock(); ++i) {
memcpy(Y.getPtr(i),&RHS[ldRHS*i],nbLines*sizeof(Scalar));
memcpy(blockRes.getPtr(),&RHS[i*ldRHS], nbLines*sizeof(Scalar));
}
......
......@@ -85,8 +85,8 @@ public:
std::cout<<name<<"\tnbLines :: "
<<sumNbVectInBlck[currentSize]+Parent::SizeBlock<<"\t"
<<"nbCols :: "<<sumNbVectInBlck[currentSize]<<"\n";
for (int j=0 ; j<sumNbVectInBlck[currentSize]+Parent::SizeBlock ; ++j) {
for (int i=0 ; i<sumNbVectInBlck[currentSize] ; ++i) {
for (int j=0; j<sumNbVectInBlck[currentSize]+Parent::SizeBlock; ++j) {
for (int i=0; i<sumNbVectInBlck[currentSize]; ++i) {
if (module<Scalar,Primary>(Parent::getPtr()[i*Parent::getLeadingDim()+j])
!= Primary(0)) {
std::cout<<"."<<" ";
......@@ -128,7 +128,7 @@ public:
+ sumNbVectInBlck[currentSize]
+ inSizeBlock );
for (int i=0 ; i< inSizeBlock ; ++i) {
for (int i=0; i< inSizeBlock; ++i) {
memcpy(&toWrite[i*Parent::getLeadingDim()],R.getPtr(i),
inSizeBlock*sizeof(Scalar));
}
......@@ -140,9 +140,9 @@ public:
void displayHess(std::string name = "")
{
std::cout<<name<<" ^{H} \t"<<"Current Size "<<currentSize<<"\n";
for (int i = 0 ; i < sumNbVectInBlck[currentSize] ; ++i) { //Loop over columns
for (int i = 0; i < sumNbVectInBlck[currentSize]; ++i) { //Loop over columns
std::cout<<"Col"<<i<<" ";
for (int j=0 ; j<sumNbVectInBlck[currentSize]+Parent::SizeBlock ; ++j) {
for (int j=0; j<sumNbVectInBlck[currentSize]+Parent::SizeBlock; ++j) {
std::cout<<Parent::getPtr()[i*Parent::getLeadingDim() + j]<<" ";
}
std::cout<<"\n";
......@@ -167,8 +167,8 @@ public:
std::cout<<"R1 is "<<R1.getSizeBlock()<<" x "<<R1.getLeadingDim()
<<" and will be read until "<<Parent::SizeBlock+nb_ev<<"\n";
for (int i=0 ; i<Parent::SizeBlock ; ++i) {
for (int j=0 ; j < R1.getLeadingDim() ; ++j) {
for (int i=0; i<Parent::SizeBlock; ++i) {
for (int j=0; j < R1.getLeadingDim(); ++j) {
r[nbLineUsed*i+j] = R1.getPtr(i)[j];
}
}
......@@ -176,7 +176,7 @@ public:
<<nbCols<<" x "<<nbLineUsed<<"\n";
Scalar * workingCopy = new Scalar[nbCols * nbLineUsed];
//Filling it
for (int i=0 ; i<nbCols ; ++i) {
for (int i=0; i<nbCols; ++i) {
memcpy(&workingCopy[i*nbLineUsed],
&getPtr()[i*Parent::getLeadingDim()],
sizeof(Scalar)*nbLineUsed);
......@@ -196,7 +196,7 @@ public:
}
//copy inside Yj
for (int i=0 ; i<Parent::SizeBlock ; ++i) {
for (int i=0; i<Parent::SizeBlock; ++i) {
memcpy(Yj.getPtr(i),
&r[i*nbLineUsed],
sizeof(Scalar)*nbCols);
......@@ -229,8 +229,8 @@ public:
Scalar(-1),Scalar(0));
//outputRes - R
for (int idxRHS=0 ; idxRHS<Parent::SizeBlock ; ++idxRHS)
for (int i = 0 ; i<R.getLeadingDim() ; ++i)
for (int idxRHS=0; idxRHS<Parent::SizeBlock; ++idxRHS)
for (int i = 0; i<R.getLeadingDim(); ++i)
outputRes.getPtr(idxRHS)[i] += R.getPtr(idxRHS)[i];
}
};
......
......@@ -79,7 +79,7 @@ public:
out<<"Warning, display transposed \n";
for (int i = 0; i < nbTotCols; ++i) {
out<<"Col"<<i<<" ";
for (int j=0 ; j<ldH ; ++j) {
for (int j=0; j<ldH; ++j) {