Fix CCOLAMD base cases for 0 and 1 variables
In both cases there's no need to find out any ordering at all: - For 0 variables, an empty Ordering is returned. - For 1 variable, an Ordering with that 1 variable is returned.release/4.3a0
parent
25bf277cde
commit
86d1d42c36
|
|
@ -53,8 +53,19 @@ Ordering Ordering::ColamdConstrained(const VariableIndex& variableIndex,
|
|||
gttic(Ordering_COLAMDConstrained);
|
||||
|
||||
gttic(Prepare);
|
||||
const size_t nVars = variableIndex.size();
|
||||
if (nVars == 0)
|
||||
{
|
||||
return Ordering();
|
||||
}
|
||||
|
||||
if (nVars == 1)
|
||||
{
|
||||
return Ordering(std::vector<Key>(1, variableIndex.begin()->first));
|
||||
}
|
||||
|
||||
const size_t nEntries = variableIndex.nEntries(), nFactors =
|
||||
variableIndex.nFactors(), nVars = variableIndex.size();
|
||||
variableIndex.nFactors();
|
||||
// Convert to compressed column major format colamd wants it in (== MATLAB format!)
|
||||
const size_t Alen = ccolamd_recommended((int) nEntries, (int) nFactors,
|
||||
(int) nVars); /* colamd arg 3: size of the array A */
|
||||
|
|
|
|||
Loading…
Reference in New Issue