Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rm new #19

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 16 additions & 28 deletions src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,43 +449,31 @@ const AreaLink* AreaList::findLink(const AreaName& area, const AreaName& with) c

void AreaList::clear()
{
delete[] byIndex;
byIndex = nullptr;
byIndex.clear();

if (!areas.empty())
{
Area::Map copy;
copy.swap(areas);
Area::Map copy;
copy.swap(areas);

auto end = copy.end();
for (auto i = copy.begin(); i != end; ++i)
{
delete i->second;
}
auto end = copy.end();
for (auto i = copy.begin(); i != end; ++i)
{
delete i->second;
}
}

void AreaList::rebuildIndexes()
{
delete[] byIndex;
byIndex.clear();

if (areas.empty())
{
byIndex = nullptr;
}
else
{
using AreaWeakPtr = Area*;
byIndex = new AreaWeakPtr[areas.size()];
byIndex.resize(areas.size());

uint indx = 0;
auto end = areas.end();
for (auto i = areas.begin(); i != end; ++i, ++indx)
{
Area* area = i->second;
byIndex[indx] = area;
area->index = indx;
}
uint indx = 0;
auto end = areas.end();
for (auto i = areas.begin(); i != end; ++i, ++indx)
{
Area* area = i->second;
byIndex[indx] = area;
area->index = indx;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/study/include/antares/study/area/area.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ class AreaList final: public Yuni::NonCopyable<AreaList>

public:
//! All areas by their index
Area** byIndex = nullptr;
std::vector<Area*> byIndex;
//! All areas in the list
Area::Map areas;

Expand Down
6 changes: 3 additions & 3 deletions src/solver/misc/include/antares/solver/misc/cholesky.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bool Cholesky(U1& L, U2& A, uint size, T* temp)

for (uint i = 0; i < size; ++i)
{
typename MatrixSubColumn<U1>::Type Li = L[i];
auto& Li = L[i];

// on calcule d'abord L[i][i]
som = A[i][i];
Expand All @@ -58,8 +58,8 @@ bool Cholesky(U1& L, U2& A, uint size, T* temp)
// maintenant on cherche L[k][i], k > i.
for (uint k = i + 1; k < size; ++k)
{
typename MatrixSubColumn<U1>::Type Lk = L[k];
typename MatrixSubColumn<U2>::Type Ak = A[k];
auto& Lk = L[k];
auto& Ak = A[k];

if (temp[k] == Ak[k])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class XCast final: private Yuni::NonCopyable<XCast>
/*!
** \brief Destructor
*/
~XCast();
~XCast() = default;
//@}

//! \name Loading
Expand Down Expand Up @@ -105,7 +105,6 @@ class XCast final: private Yuni::NonCopyable<XCast>

private:
void allocateTemporaryData();
void destroyTemporaryData();

template<class PredicateT>
void updateMissingCoefficients(PredicateT& predicate);
Expand Down Expand Up @@ -180,7 +179,7 @@ class XCast final: private Yuni::NonCopyable<XCast>
//! The correlation matrix for the current month
const Matrix<float>* pCorrMonth;

bool pNeverInitialized;
bool pNeverInitialized = true;
uint Nombre_points_intermediaire;

//! True when starting a new month (some data may have to be reinitialized)
Expand All @@ -192,57 +191,58 @@ class XCast final: private Yuni::NonCopyable<XCast>
uint pNDPMatrixCount;
uint pLevellingCount;

bool pAccuracyOnCorrelation;
bool pAccuracyOnCorrelation = false;
bool All_normal; // all processes are Normal

float* A; // les variables de A à CO sont des vues de ALPH à CORR pour un mois particulier
float* B;
float* G;
float* D;
int* M;
float* T;
Data::XCast::Distribution* L;
bool* BO;
float* MA;
float* MI;
float** FO; // contrainte : FO >=0
// les variables de A à CO sont des vues de ALPH à CORR pour un mois particulier
std::vector<float> A;
std::vector<float> B;
std::vector<float> G;
std::vector<float> D;
std::vector<int> M;
std::vector<float> T;
std::vector<Data::XCast::Distribution> L;
std::vector<bool> BO;
std::vector<float> MA;
std::vector<float> MI;
std::vector<std::vector<float>> FO; // contrainte : FO >=0

float STEP;
float SQST;
float* POSI;
float** CORR;
float* MAXI;
float* MINI;
float* Presque_maxi;
float* Presque_mini;
float* ESPE;
float* STDE;
float** LISS;
float** DATL;

float* DIFF;
float* TREN;
float* WIEN;
float* BROW;

float* BASI; // used only if all processes are Normal
float* ALPH; // used only if all processes are Normal
float* BETA; // used only if all processes are Normal

float** Triangle_reference;
float** Triangle_courant;
float** Carre_reference;
float** Carre_courant;

float* D_COPIE;

float** DATA;
std::vector<float> POSI;
std::vector<std::vector<float>> CORR;
std::vector<float> MAXI;
std::vector<float> MINI;
std::vector<float> Presque_maxi;
std::vector<float> Presque_mini;
std::vector<float> ESPE;
std::vector<float> STDE;
std::vector<std::vector<float>> LISS;
std::vector<std::vector<float>> DATL;

std::vector<float> DIFF;
std::vector<float> TREN;
std::vector<float> WIEN;
std::vector<float> BROW;

std::vector<float> BASI; // used only if all processes are Normal
std::vector<float> ALPH; // used only if all processes are Normal
std::vector<float> BETA; // used only if all processes are Normal

std::vector<std::vector<float>> Triangle_reference;
std::vector<std::vector<float>> Triangle_courant;
std::vector<std::vector<float>> Carre_reference;
std::vector<std::vector<float>> Carre_courant;

std::vector<float> D_COPIE;

std::vector<std::vector<float>> DATA;

// cholesky temporary data
float* pQCHOLTotal;
std::vector<float> pQCHOLTotal;

//!
bool* pUseConversion;
std::vector<bool> pUseConversion;

//! Name of the current timeseries
Yuni::CString<32, false> pTSName;
Expand Down
13 changes: 8 additions & 5 deletions src/solver/ts-generator/xcast/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool XCast::generateValuesForTheCurrentDay()
// si les parametres ont change on reinitialise certaines variables intermediaires
if (pNewMonth)
{
if (Cholesky<float>(Triangle_courant, pCorrMonth->entry, processCount, pQCHOLTotal))
if (Cholesky<float>(Triangle_courant, pCorrMonth->entry, processCount, pQCHOLTotal.data()))
{
// C n'est pas sdp, mais peut-etre proche de sdp
// on tente un abattement de 0.999
Expand All @@ -107,7 +107,10 @@ bool XCast::generateValuesForTheCurrentDay()
}
}

if (Cholesky<float>(Triangle_courant, pCorrMonth->entry, processCount, pQCHOLTotal))
if (Cholesky<float>(Triangle_courant,
pCorrMonth->entry,
processCount,
pQCHOLTotal.data()))
{
// la matrice C n'est pas admissible, on abandonne
logs.error() << "TS " << pTSName << " generator: invalid correlation matrix";
Expand Down Expand Up @@ -227,7 +230,7 @@ bool XCast::generateValuesForTheCurrentDay()
Carre_reference,
pCorrMonth->entry,
processCount,
pQCHOLTotal);
pQCHOLTotal.data());
if (shrink == -1.f)
{
// sortie impossible car on a v�rifi� que C est d.p
Expand Down Expand Up @@ -414,7 +417,7 @@ bool XCast::generateValuesForTheCurrentDay()

for (uint s = 0; s != processCount; ++s)
{
float* corr_s = CORR[s];
auto& corr_s = CORR[s];
auto& userMonthlyCorr = pCorrMonth->column(s);
for (uint t = 0; t < s; ++t)
{
Expand Down Expand Up @@ -453,7 +456,7 @@ bool XCast::generateValuesForTheCurrentDay()
Carre_courant,
Carre_reference,
processCount,
pQCHOLTotal);
pQCHOLTotal.data());
if (shrink <= 1.f)
{
if (shrink == -1.f)
Expand Down
Loading
Loading