106template<
class Element>
 
  116template <
class Element>
 
  129template<
class Element>
 
  139      Error(
"TMatrixTSparse",
"Inconsistency between row index and its range");
 
  141         Info(
"TMatrixTSparse",
"row index lower bound adjusted to %d",row[
irowmin]);
 
  145         Info(
"TMatrixTSparse",
"row index upper bound adjusted to %d",row[
irowmax]);
 
  150      Error(
"TMatrixTSparse",
"Inconsistency between column index and its range");
 
  152         Info(
"TMatrixTSparse",
"column index lower bound adjusted to %d",col[
icolmin]);
 
  156         Info(
"TMatrixTSparse",
"column index upper bound adjusted to %d",col[
icolmax]);
 
  163   SetMatrixArray(
nr,row,col,
data);
 
  173template <
class Element>
 
  179   if (
n <= 0 || 
nr < 0) {
 
  180      Error(
"TMatrixTSparse", 
"Inconsistency in row indices");
 
  190      Error(
"TMatrixTSparse", 
"Inconsistency between column index and its range");
 
  192         Info(
"TMatrixTSparse", 
"column index lower bound adjusted to %d", col[
icolmin]);
 
  196         Info(
"TMatrixTSparse", 
"column index upper bound adjusted to %d", col[
icolmax]);
 
  202   memcpy(fElements, 
data, this->fNelems * 
sizeof(Element));
 
  204   memcpy(fColIndex, col, this->fNelems * 
sizeof(
Int_t));
 
  210template<
class Element>
 
  223template<
class Element>
 
  236template<
class Element>
 
  278         Error(
"TMatrixTSparse(EMatrixCreatorOp1)",
"operation %d not yet implemented", 
op);
 
 
  286template<
class Element>
 
  310         Error(
"TMatrixTSparse(EMatrixCreatorOp2)", 
"operation %d not yet implemented",
op);
 
 
  318template<
class Element>
 
  342         Error(
"TMatrixTSparse(EMatrixCreatorOp2)", 
"operation %d not yet implemented",
op);
 
 
  350template<
class Element>
 
  374         Error(
"TMatrixTSparse(EMatrixCreatorOp2)", 
"operation %d not yet implemented",
op);
 
 
  383template<
class Element>
 
  400   this->fNrowIndex = this->fNrows+1;
 
  402   this->fIsOwner   = 
kTRUE;
 
  403   this->fTol       = std::numeric_limits<Element>::epsilon();
 
  405   fRowIndex = 
new Int_t[this->fNrowIndex];
 
  407      memset(fRowIndex,0,this->fNrowIndex*
sizeof(
Int_t));
 
  409   if (this->fNelems > 0) {
 
  410      fElements = 
new Element[this->fNelems];
 
  411      fColIndex = 
new Int_t   [this->fNelems];
 
  413         memset(fElements,0,this->fNelems*
sizeof(Element));
 
 
  425template<
class Element>
 
  430   const Int_t nr = (
n > 0) ? 
n : this->fNcols;
 
  434         Error(
"InsertRow",
"row %d out of matrix range",
rown);
 
  439         Error(
"InsertRow",
"column %d out of matrix range",
coln);
 
  444         Error(
"InsertRow",
"row length %d out of range",
nr);
 
  473   this->fNelems += 
ndiff;
 
  474   fColIndex = 
new Int_t[this->fNelems];
 
  475   fElements = 
new Element[this->fNelems];
 
  491   for (
Int_t i = 0; i < 
nr; i++) {
 
  500   R__ASSERT(this->fNelems == fRowIndex[this->fNrowIndex-1]);
 
 
  508template<
class Element>
 
  513   const Int_t nr = (
n > 0) ? 
n : this->fNcols;
 
  517         Error(
"ExtractRow",
"row %d out of matrix range",
rown);
 
  522         Error(
"ExtractRow",
"column %d out of matrix range",
coln);
 
  527         Error(
"ExtractRow",
"row length %d out of range",
nr);
 
  537   const Element * 
const pData     = GetMatrixArray();
 
 
  551template <
class Element>
 
  559      if (
lhs.GetNrows() != 
rhs.GetNcols() || 
rhs.GetColLwb() != 
lhs.GetRowLwb()) {
 
  560         Error(
"conservative_sparse_sparse_product_impl", 
"lhs and rhs columns incompatible");
 
  571   auto mask = std::unique_ptr<bool[]>(
new bool[
rows]);
 
  572   auto values = std::unique_ptr<Element[]>(
new Element[
rows]);
 
  573   auto indices = std::unique_ptr<Int_t[]>(
new Int_t[
rows]);
 
  575   std::memset(
mask.get(), 
false, 
sizeof(
bool) * 
rows);
 
  576   std::memset(values.get(), 0, 
sizeof(Element) * 
rows);
 
  577   std::memset(indices.get(), 0, 
sizeof(
Int_t) * 
rows);
 
  583   const Element *
lhsVal = 
lhs.GetMatrixArray();
 
  584   const Element *
rhsVal = 
rhs.GetMatrixArray();
 
  602         std::memset(
mask.get(), 
false, 
sizeof(
bool) * 
rows);
 
  615   Element *
pData = this->GetMatrixArray();
 
  649         Error(
"conservative_sparse_sparse_product_impl", 
"non zeros numbers do not match");
 
 
  661template<
class Element>
 
  668      if (
a.GetNcols() != 
b.GetNcols() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
  669         Error(
"AMultBt",
"A and B columns incompatible");
 
  673      if (!
constr && this->GetMatrixArray() == 
a.GetMatrixArray()) {
 
  674         Error(
"AMultB",
"this = &a");
 
  678      if (!
constr && this->GetMatrixArray() == 
b.GetMatrixArray()) {
 
  679         Error(
"AMultB",
"this = &b");
 
  702      Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(),1,nc);
 
  721   const Element * 
const pDataa = 
a.GetMatrixArray();
 
  722   const Element * 
const pDatab = 
b.GetMatrixArray();
 
  723   Element * 
const pDatac = this->GetMatrixArray();
 
 
  752template<
class Element>
 
  759      if (
a.GetNcols() != 
b.GetNcols() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
  760         Error(
"AMultBt",
"A and B columns incompatible");
 
  764      if (!
constr && this->GetMatrixArray() == 
a.GetMatrixArray()) {
 
  765         Error(
"AMultB",
"this = &a");
 
  769      if (!
constr && this->GetMatrixArray() == 
b.GetMatrixArray()) {
 
  770         Error(
"AMultB",
"this = &b");
 
  793      Allocate(
a.GetNrows(),
b.GetNrows(),
a.GetRowLwb(),
b.GetRowLwb(),1,nc);
 
  813   const Element * 
const pDataa = 
a.GetMatrixArray();
 
  814   const Element * 
const pDatab = 
b.GetMatrixArray();
 
  815   Element * 
const pDatac = this->GetMatrixArray();
 
 
  844template<
class Element>
 
  851      if (
a.GetNrows()  != 
b.GetNrows()  || 
a.GetNcols()  != 
b.GetNcols() ||
 
  852          a.GetRowLwb() != 
b.GetRowLwb() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
  853         Error(
"APlusB(const TMatrixTSparse &,const TMatrixTSparse &",
"matrices not compatible");
 
  857      if (!
constr && this->GetMatrixArray() == 
a.GetMatrixArray()) {
 
  858         Error(
"APlusB",
"this = &a");
 
  862      if (!
constr && this->GetMatrixArray() == 
b.GetMatrixArray()) {
 
  863         Error(
"APlusB",
"this = &b");
 
  874      Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb());
 
  875      SetSparseIndexAB(
a,
b);
 
  881   const Element * 
const pDataa = 
a.GetMatrixArray();
 
  882   const Element * 
const pDatab = 
b.GetMatrixArray();
 
  883   Element * 
const pDatac = this->GetMatrixArray();
 
 
  926template<
class Element>
 
  933      if (
a.GetNrows()  != 
b.GetNrows()  || 
a.GetNcols()  != 
b.GetNcols() ||
 
  934          a.GetRowLwb() != 
b.GetRowLwb() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
  935         Error(
"APlusB(const TMatrixTSparse &,const TMatrixT &",
"matrices not compatible");
 
  939      if (!
constr && this->GetMatrixArray() == 
a.GetMatrixArray()) {
 
  940         Error(
"APlusB",
"this = &a");
 
  944      if (!
constr && this->GetMatrixArray() == 
b.GetMatrixArray()) {
 
  945         Error(
"APlusB",
"this = &b");
 
  951      Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb());
 
  952      SetSparseIndexAB(
a,
b);
 
  961   const Element * 
const pDataa = 
a.GetMatrixArray();
 
  962   const Element * 
const pDatab = 
b.GetMatrixArray();
 
  963   Element * 
const pDatac = this->GetMatrixArray();
 
 
  997template<
class Element>
 
 1004      if (
a.GetNrows()  != 
b.GetNrows()  || 
a.GetNcols()  != 
b.GetNcols() ||
 
 1005          a.GetRowLwb() != 
b.GetRowLwb() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
 1006         Error(
"AMinusB(const TMatrixTSparse &,const TMatrixTSparse &",
"matrices not compatible");
 
 1010      if (!
constr && this->GetMatrixArray() == 
a.GetMatrixArray()) {
 
 1011         Error(
"AMinusB",
"this = &a");
 
 1015      if (!
constr && this->GetMatrixArray() == 
b.GetMatrixArray()) {
 
 1016         Error(
"AMinusB",
"this = &b");
 
 1027      Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb());
 
 1028      SetSparseIndexAB(
a,
b);
 
 1034   const Element * 
const pDataa = 
a.GetMatrixArray();
 
 1035   const Element * 
const pDatab = 
b.GetMatrixArray();
 
 1036   Element * 
const pDatac = this->GetMatrixArray();
 
 
 1079template<
class Element>
 
 1086      if (
a.GetNrows()  != 
b.GetNrows()  || 
a.GetNcols()  != 
b.GetNcols() ||
 
 1087          a.GetRowLwb() != 
b.GetRowLwb() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
 1088          Error(
"AMinusB(const TMatrixTSparse &,const TMatrixT &",
"matrices not compatible");
 
 1092      if (!
constr && this->GetMatrixArray() == 
a.GetMatrixArray()) {
 
 1093         Error(
"AMinusB",
"this = &a");
 
 1097      if (!
constr && this->GetMatrixArray() == 
b.GetMatrixArray()) {
 
 1098         Error(
"AMinusB",
"this = &b");
 
 1104      Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb());
 
 1105      SetSparseIndexAB(
a,
b);
 
 1114   const Element * 
const pDataa = 
a.GetMatrixArray();
 
 1115   const Element * 
const pDatab = 
b.GetMatrixArray();
 
 1116   Element * 
const pDatac = this->GetMatrixArray();
 
 
 1150template<
class Element>
 
 1157      if (
a.GetNrows()  != 
b.GetNrows()  || 
a.GetNcols()  != 
b.GetNcols() ||
 
 1158          a.GetRowLwb() != 
b.GetRowLwb() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
 1159         Error(
"AMinusB(const TMatrixT &,const TMatrixTSparse &",
"matrices not compatible");
 
 1163      if (!
constr && this->GetMatrixArray() == 
a.GetMatrixArray()) {
 
 1164         Error(
"AMinusB",
"this = &a");
 
 1168      if (!
constr && this->GetMatrixArray() == 
b.GetMatrixArray()) {
 
 1169         Error(
"AMinusB",
"this = &b");
 
 1175      Allocate(
a.GetNrows(),
a.GetNcols(),
a.GetRowLwb(),
a.GetColLwb());
 
 1176      SetSparseIndexAB(
a,
b);
 
 1185   const Element * 
const pDataa = 
a.GetMatrixArray();
 
 1186   const Element * 
const pDatab = 
b.GetMatrixArray();
 
 1187   Element * 
const pDatac = this->GetMatrixArray();
 
 
 1220template<
class Element>
 
 1225   const Element * 
const elem = GetMatrixArray();
 
 
 1234template<
class Element>
 
 1239      Error(
"SetMatrixArray(Int_t,Int_t*,Int_t*,Element*",
"nr <= 0");
 
 1251   if (row[
irowmin] <  this->fRowLwb|| row[
irowmax] > this->fRowLwb+this->fNrows-1) {
 
 1252      Error(
"SetMatrixArray",
"Inconsistency between row index and its range");
 
 1253      if (row[
irowmin] < this->fRowLwb) {
 
 1254         Info(
"SetMatrixArray",
"row index lower bound adjusted to %d",row[
irowmin]);
 
 1257      if (row[
irowmax] > this->fRowLwb+this->fNrows-1) {
 
 1258         Info(
"SetMatrixArray",
"row index upper bound adjusted to %d",row[
irowmax]);
 
 1259         this->fNrows = row[
irowmax]-this->fRowLwb+1;
 
 1262   if (col[
icolmin] < this->fColLwb || col[
icolmax] > this->fColLwb+this->fNcols-1) {
 
 1263      Error(
"SetMatrixArray",
"Inconsistency between column index and its range");
 
 1264      if (col[
icolmin] < this->fColLwb) {
 
 1265         Info(
"SetMatrixArray",
"column index lower bound adjusted to %d",col[
icolmin]);
 
 1268      if (col[
icolmax] > this->fColLwb+this->fNcols-1) {
 
 1269         Info(
"SetMatrixArray",
"column index upper bound adjusted to %d",col[
icolmax]);
 
 1270         this->fNcols = col[
icolmax]-this->fColLwb+1;
 
 1275   nr = ReduceSparseMatrix(
nr, row, col, 
data);
 
 1278   const Element *
ep        = 
data;
 
 1279   const Element * 
const fp = 
data+
nr;
 
 1285      if (fColIndex) { 
delete [] fColIndex; fColIndex = 
nullptr; }
 
 1286      if (fElements) { 
delete [] fElements; fElements = 
nullptr; }
 
 1288      if (this->fNelems > 0) {
 
 1292         fColIndex = 
nullptr;
 
 1293         fElements = 
nullptr;
 
 1297   if (this->fNelems <= 0)
 
 
 1327template <
class Element>
 
 1334   while (i < 
nz - 1) {
 
 1335      if ((row[i] == row[i + 1]) && (col[i] == col[i + 1])) {
 
 1342            row[
j] = row[
j + 1];
 
 1343            col[
j] = col[
j + 1];
 
 
 1352template <
class Element>
 
 1358      Error(
"SetMatrixArray(Int_t,Int_t*,Int_t*,Element*", 
"nr <= 0");
 
 1362   if (
nrows != this->fNrows) {
 
 1365         fRowIndex = 
nullptr;
 
 1367      this->fNrows = 
nrows;
 
 1368      if (this->fNrows > 0) {
 
 1370         this->fNrowIndex = 
nrows + 1;
 
 1372         fRowIndex = 
nullptr;
 
 1373         this->fNrowIndex = 0;
 
 1377   if (
ncols != this->fNcols) {
 
 1378      this->fNcols = 
ncols;
 
 1381   if (this->fRowLwb != this->fColLwb) {
 
 1382      auto tmp = this->fRowLwb;
 
 1383      this->fRowLwb = this->fColLwb;
 
 1384      this->fColLwb = tmp;
 
 1395   if (row[
irowmin] < this->fRowLwb || row[
irowmax] > this->fRowLwb + this->fNrows - 1) {
 
 1396      Error(
"SetMatrixArray", 
"Inconsistency between row index and its range");
 
 1397      if (row[
irowmin] < this->fRowLwb) {
 
 1398         Info(
"SetMatrixArray", 
"row index lower bound adjusted to %d", row[
irowmin]);
 
 1401      if (row[
irowmax] > this->fRowLwb + this->fNrows - 1) {
 
 1402         Info(
"SetMatrixArray", 
"row index upper bound adjusted to %d", row[
irowmax]);
 
 1403         this->fNrows = row[
irowmax] - this->fRowLwb + 1;
 
 1406   if (col[
icolmin] < this->fColLwb || col[
icolmax] > this->fColLwb + this->fNcols - 1) {
 
 1407      Error(
"SetMatrixArray", 
"Inconsistency between column index and its range");
 
 1408      if (col[
icolmin] < this->fColLwb) {
 
 1409         Info(
"SetMatrixArray", 
"column index lower bound adjusted to %d", col[
icolmin]);
 
 1412      if (col[
icolmax] > this->fColLwb + this->fNcols - 1) {
 
 1413         Info(
"SetMatrixArray", 
"column index upper bound adjusted to %d", col[
icolmax]);
 
 1414         this->fNcols = col[
icolmax] - this->fColLwb + 1;
 
 1419   nr = ReduceSparseMatrix(
nr, row, col, 
data);
 
 1422   const Element *
ep = 
data;
 
 1423   const Element *
const fp = 
data + 
nr;
 
 1432         fColIndex = 
nullptr;
 
 1436         fElements = 
nullptr;
 
 1439      if (this->fNelems > 0) {
 
 1443         fColIndex = 
nullptr;
 
 1444         fElements = 
nullptr;
 
 1448   if (this->fNelems <= 0)
 
 
 1476template<
class Element>
 
 1487      Element *
oDp = fElements;
 
 
 1510template<
class Element>
 
 1515      if (this->GetNrows()  != 
source.GetNrows()  || 
this->GetNcols()  != 
source.GetNcols() ||
 
 1517         Error(
"SetSparseIndex",
"matrices not compatible");
 
 1527   if (
source.GetRowIndexArray() && 
source.GetColIndexArray()) {
 
 1531      const Element *
ep = 
source.GetMatrixArray();
 
 1543      fRowIndex[this->fNrows] = 
nr;
 
 
 1553template<
class Element>
 
 1560      if (
a.GetNrows()  != 
b.GetNrows()  || 
a.GetNcols()  != 
b.GetNcols() ||
 
 1561          a.GetRowLwb() != 
b.GetRowLwb() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
 1562         Error(
"SetSparseIndexAB",
"source matrices not compatible");
 
 1566      if (this->GetNrows()  != 
a.GetNrows()  || 
this->GetNcols()  != 
a.GetNcols() ||
 
 1567          this->GetRowLwb() != 
a.GetRowLwb() || 
this->GetColLwb() != 
a.GetColLwb()) {
 
 1568         Error(
"SetSparseIndexAB",
"matrix not compatible with source matrices");
 
 1606   if (this->NonZeros() != nc)
 
 
 1647template<
class Element>
 
 1654      if (
a.GetNrows()  != 
b.GetNrows()  || 
a.GetNcols()  != 
b.GetNcols() ||
 
 1655          a.GetRowLwb() != 
b.GetRowLwb() || 
a.GetColLwb() != 
b.GetColLwb()) {
 
 1656         Error(
"SetSparseIndexAB",
"source matrices not compatible");
 
 1660      if (this->GetNrows()  != 
a.GetNrows()  || 
this->GetNcols()  != 
a.GetNcols() ||
 
 1661          this->GetRowLwb() != 
a.GetRowLwb() || 
this->GetColLwb() != 
a.GetColLwb()) {
 
 1662         Error(
"SetSparseIndexAB",
"matrix not compatible with source matrices");
 
 1667   const Element * 
const pDataa = 
a.GetMatrixArray();
 
 1694   if (this->NonZeros() != nc)
 
 
 1732template<
class Element>
 
 1736   if (!this->fIsOwner) {
 
 1737      Error(
"ResizeTo(Int_t,Int_t,Int_t)",
"Not owner of data array,cannot resize");
 
 1741   if (this->fNelems > 0) {
 
 1742      if (this->fNrows == 
nrows && this->fNcols == 
ncols &&
 
 
 1826template<
class Element>
 
 1831   if (!this->fIsOwner) {
 
 1832      Error(
"ResizeTo(Int_t,Int_t,Int_t,Int_t,Int_t)",
"Not owner of data array,cannot resize");
 
 1839   if (this->fNelems > 0) {
 
 
 1925template<
class Element>
 
 1946   this->fNrowIndex = this->fNrows+1;
 
 1949   this->fTol       = std::numeric_limits<Element>::epsilon();
 
 
 1965template<
class Element>
 
 1972         Error(
"GetSub",
"row_lwb out-of-bounds");
 
 1976         Error(
"GetSub",
"col_lwb out-of-bounds");
 
 1980         Error(
"GetSub",
"row_upb out-of-bounds");
 
 1984         Error(
"GetSub",
"col_upb out-of-bounds");
 
 1988         Error(
"GetSub",
"row_upb < row_lwb || col_upb < col_lwb");
 
 2016   const Element *
ep = this->GetMatrixArray();
 
 2022   if (
target.GetRowIndexArray() && 
target.GetColIndexArray()) {
 
 
 2065template<
class Element>
 
 2073         Error(
"SetSub",
"row_lwb out-of-bounds");
 
 2077         Error(
"SetSub",
"col_lwb out-of-bounds");
 
 2081         Error(
"SetSub",
"source matrix too large");
 
 2113   fRowIndex = 
new Int_t[this->fNrowIndex];
 
 2189   R__ASSERT(this->fNelems == fRowIndex[this->fNrowIndex-1]);
 
 
 2201template<
class Element>
 
 2208      if (
source.NonZeros() <= 0)
 
 2242   R__ASSERT(this->fNelems == fRowIndex[this->fNrowIndex-1]);
 
 
 2253template<
class Element>
 
 2258   if (fElements) { 
delete [] fElements; fElements = 
nullptr; }
 
 2259   if (fColIndex) { 
delete [] fColIndex; fColIndex = 
nullptr; }
 
 2261   memset(this->GetRowIndexArray(),0,this->fNrowIndex*
sizeof(
Int_t));
 
 
 2269template<
class Element>
 
 2277   for (i = this->fRowLwb; i <= this->fRowLwb+this->fNrows-1; i++)
 
 2278      for (
Int_t j = this->fColLwb; 
j <= this->fColLwb+this->fNcols-1; 
j++)
 
 2286      Element *
oDp = fElements;
 
 2293   for (i = this->fRowLwb; i <= this->fRowLwb+this->fNrows-1; i++) {
 
 2294      for (
Int_t j = this->fColLwb; 
j <= this->fColLwb+this->fNcols-1; 
j++) {
 
 2298            fElements[
ielem]   = 1.0;
 
 2299            fColIndex[
ielem++] = 
j-this->fColLwb;
 
 
 2311template<
class Element>
 
 2316   const Element *       
ep = GetMatrixArray();
 
 2317   const Element * 
const fp = 
ep+this->fNelems;
 
 2318   const Int_t   * 
const pR = GetRowIndexArray();
 
 
 2340template<
class Element>
 
 2347   const Element *       
ep = mt.GetMatrixArray();
 
 2348   const Element * 
const fp = 
ep+this->fNcols;
 
 2355      for (
Int_t i = 0; i < this->fNrows; i++,
ep += this->fNcols)
 
 2357      ep -= this->fNelems-1;         
 
 
 2368template<
class Element>
 
 2376      Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
rown,this->fRowLwb,this->fRowLwb+this->fNrows);
 
 2377      return fElements[0];
 
 2380      Error(
"operator()",
"Request column(%d) outside matrix range of %d - %d",
coln,this->fColLwb,this->fColLwb+this->fNcols);
 
 2381      return fElements[0];
 
 2387   if (this->fNrowIndex > 0 && fRowIndex[this->fNrowIndex-1] != 0) {
 
 2394      return fElements[
index];
 
 2402         return fElements[
index];
 
 2404         Error(
"operator()(Int_t,Int_t",
"Insert row failed");
 
 2405         return fElements[0];
 
 
 2412template <
class Element>
 
 2416   if (this->fNrowIndex > 0 && this->fRowIndex[this->fNrowIndex-1] == 0) {
 
 2417      Error(
"operator()(Int_t,Int_t) const",
"row/col indices are not set");
 
 2418      Info(
"operator()",
"fNrowIndex = %d fRowIndex[fNrowIndex-1] = %d\n",this->fNrowIndex,this->fRowIndex[this->fNrowIndex-1]);
 
 2425      Error(
"operator()",
"Request row(%d) outside matrix range of %d - %d",
rown,this->fRowLwb,this->fRowLwb+this->fNrows);
 
 2429      Error(
"operator()",
"Request column(%d) outside matrix range of %d - %d",
coln,this->fColLwb,this->fColLwb+this->fNcols);
 
 2437   else                                             return fElements[
index];
 
 
 2444template<
class Element>
 
 2448      Error(
"operator=(const TMatrixTSparse &)",
"matrices not compatible");
 
 2452   if (this->GetMatrixArray() != 
source.GetMatrixArray()) {
 
 2455      const Element * 
const sp = 
source.GetMatrixArray();
 
 2456            Element * 
const tp = this->GetMatrixArray();
 
 2458      this->fTol = 
source.GetTol();
 
 
 2467template<
class Element>
 
 2471      Error(
"operator=(const TMatrixT &)",
"matrices not compatible");
 
 2475   if (this->GetMatrixArray() != 
source.GetMatrixArray()) {
 
 2478      const Element * 
const sp = 
source.GetMatrixArray();
 
 2479            Element * 
const tp = this->GetMatrixArray();
 
 2489      this->fTol = 
source.GetTol();
 
 
 2498template<
class Element>
 
 2503   if (fRowIndex[this->fNrowIndex-1] == 0) {
 
 2504      Error(
"operator=(Element",
"row/col indices are not set");
 
 2508   Element *
ep = this->GetMatrixArray();
 
 2509   const Element * 
const ep_last = 
ep+this->fNelems;
 
 
 2519template<
class Element>
 
 2524   Element *
ep = this->GetMatrixArray();
 
 2525   const Element * 
const ep_last = 
ep+this->fNelems;
 
 
 2535template<
class Element>
 
 2540   Element *
ep = this->GetMatrixArray();
 
 2541   const Element * 
const ep_last = 
ep+this->fNelems;
 
 
 2551template<
class Element>
 
 2556   Element *
ep = this->GetMatrixArray();
 
 2557   const Element * 
const ep_last = 
ep+this->fNelems;
 
 
 2567template<
class Element>
 
 2572   const Element 
scale = beta-alpha;
 
 2573   const Element shift = alpha/
scale;
 
 2577   Element * 
const ep        = GetMatrixArray();
 
 2579   const Int_t m = this->GetNrows();
 
 2580   const Int_t n = this->GetNcols();
 
 2583   const Int_t nn     = this->GetNrows()*this->GetNcols();
 
 2584   const Int_t length = (this->GetNoElements() <= 
nn) ? this->GetNoElements() : 
nn;
 
 2588   for (
Int_t k = 0; k < 
nn; k++) {
 
 2589      const Element 
r = 
Drand(seed);
 
 
 2614template<
class Element>
 
 2617   const Element 
scale = beta-alpha;
 
 2618   const Element shift = alpha/
scale;
 
 2623      if (this->fNrows != this->fNcols || this->fRowLwb != this->fColLwb) {
 
 2624         Error(
"RandomizePD(Element &",
"matrix should be square");
 
 2629   const Int_t n = this->fNcols;
 
 2633   Element * 
const ep        = GetMatrixArray();
 
 2660   for (
Int_t k = 0; k < 
nn; k++ ) {
 
 2661      const Element 
r = 
Drand(seed);
 
 2670         Int_t col = k-row*(row+1)/2;
 
 2716   this->fNelems = 
nnz;
 
 2724      const Int_t    * 
const pR = this->GetRowIndexArray();
 
 2725      const Int_t    * 
const pC = this->GetColIndexArray();
 
 2726             Element * 
const pD = GetMatrixArray();
 
 
 2743template<
class Element>
 
 2752template<
class Element>
 
 2761template<
class Element>
 
 2770template<
class Element>
 
 2780template<
class Element>
 
 2790template<
class Element>
 
 2799template<
class Element>
 
 2808template<
class Element>
 
 2817template<
class Element>
 
 2827template<
class Element>
 
 2837template<
class Element>
 
 2846template<
class Element>
 
 2855template<
class Element>
 
 2864template<
class Element>
 
 2874template<
class Element>
 
 2885template<
class Element>
 
 2895template<
class Element>
 
 2899      ::Error(
"ElementMult(TMatrixTSparse &,const TMatrixTSparse &)",
"matrices not compatible");
 
 2903   const Element *
sp  = 
source.GetMatrixArray();
 
 2904         Element *
tp  = 
target.GetMatrixArray();
 
 
 2915template<
class Element>
 
 2919      ::Error(
"ElementDiv(TMatrixT &,const TMatrixT &)",
"matrices not compatible");
 
 2923   const Element *
sp  = 
source.GetMatrixArray();
 
 2924         Element *
tp  = 
target.GetMatrixArray();
 
 2926   while ( 
tp < 
ftp ) {
 
 2930         Error(
"ElementDiv",
"source element is zero");
 
 
 2940template<
class Element>
 
 2943   if (!m1.IsValid()) {
 
 2945         ::Error(
"AreCompatible", 
"matrix 1 not valid");
 
 2948   if (!m2.IsValid()) {
 
 2950         ::Error(
"AreCompatible", 
"matrix 2 not valid");
 
 2954   if (m1.GetNrows()  != m2.GetNrows()  || m1.GetNcols()  != m2.GetNcols() ||
 
 2955       m1.GetRowLwb() != m2.GetRowLwb() || m1.GetColLwb() != m2.GetColLwb()) {
 
 2957         ::Error(
"AreCompatible", 
"matrices 1 and 2 not compatible");
 
 2961   const Int_t *
pR1 = m1.GetRowIndexArray();
 
 2962   const Int_t *
pR2 = m2.GetRowIndexArray();
 
 2966         ::Error(
"AreCompatible", 
"matrices 1 and 2 have different rowIndex");
 
 2971   const Int_t *
pD1 = m1.GetColIndexArray();
 
 2972   const Int_t *
pD2 = m2.GetColIndexArray();
 
 2973   const Int_t nData = m1.GetNoElements();
 
 2976         ::Error(
"AreCompatible", 
"matrices 1 and 2 have different colIndex");
 
 2977      for (
Int_t i = 0; i < nData; i++)
 
 
 2988template<
class Element>
 
 2991   if (
R__b.IsReading()) {
 
 2996      if (this->fNelems < 0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#define templateClassImp(name)
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
 
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
 
R__EXTERN Int_t gMatrixCheck
 
template TMatrixFSparse & ElementDiv< Float_t >(TMatrixFSparse &target, const TMatrixFSparse &source)
 
template TMatrixDSparse & Add< Double_t >(TMatrixDSparse &target, Double_t scalar, const TMatrixDSparse &source)
 
template Bool_t AreCompatible< Float_t >(const TMatrixFSparse &m1, const TMatrixFSparse &m2, Int_t verbose)
 
template TMatrixDSparse & ElementDiv< Double_t >(TMatrixDSparse &target, const TMatrixDSparse &source)
 
template TMatrixFSparse & ElementMult< Float_t >(TMatrixFSparse &target, const TMatrixFSparse &source)
 
template Bool_t AreCompatible< Double_t >(const TMatrixDSparse &m1, const TMatrixDSparse &m2, Int_t verbose)
 
template TMatrixDSparse & ElementMult< Double_t >(TMatrixDSparse &target, const TMatrixDSparse &source)
 
template TMatrixFSparse & Add< Float_t >(TMatrixFSparse &target, Float_t scalar, const TMatrixFSparse &source)
 
Double_t Drand(Double_t &ix)
Random number generator [0....1] with seed ix.
 
TTime operator*(const TTime &t1, const TTime &t2)
 
TTime operator-(const TTime &t1, const TTime &t2)
 
Buffer base class used for serializing objects.
 
static void DoubleLexSort(Int_t n, Int_t *first, Int_t *second, Element *data)
default kTRUE, when Use array kFALSE
 
TMatrixTBase< Element > & Randomize(Element alpha, Element beta, Double_t &seed) override
randomize matrix element values
 
TMatrixTBase< Element > & SetMatrixArray(const Element *data, Option_t *="") override
Copy array data to matrix .
 
Int_t ReduceSparseMatrix(Int_t nr, Int_t *row, Int_t *col, Element *data)
Sum matrix entries corresponding to the same matrix element (i,j).
 
TMatrixTBase< Element > & GetSub(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, TMatrixTBase< Element > &target, Option_t *option="S") const override
Get submatrix [row_lwb..row_upb][col_lwb..col_upb]; The indexing range of the returned matrix depends...
 
TMatrixTSparse< Element > & operator+=(Element val)
Add val to every element of the matrix.
 
TMatrixTSparse< Element > & SetSparseIndex(Int_t nelem_new)
Increase/decrease the number of non-zero elements to nelems_new.
 
TMatrixTSparse< Element > & Use(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb, Int_t nr_nonzeros, Int_t *pRowIndex, Int_t *pColIndex, Element *pData)
 
TMatrixTBase< Element > & InsertRow(Int_t row, Int_t col, const Element *v, Int_t n=-1) override
Insert in row rown, n elements of array v at column coln.
 
Element ColNorm() const override
Column matrix norm, MAX{ SUM{ |M(i,j)|, over i}, over j}.
 
void Streamer(TBuffer &) override
Stream an object of class TMatrixTSparse.
 
void AMinusB(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
General matrix subtraction.
 
TMatrixTSparse< Element > & operator*=(Element val)
Multiply every element of the matrix with val.
 
void AMultBt(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
 
void GetMatrix2Array(Element *data, Option_t *="") const override
Copy matrix data to array . It is assumed that array is of size >= fNelems.
 
TMatrixTSparse< Element > & Transpose(const TMatrixTSparse< Element > &source)
Transpose a matrix. Set the matrix to ncols x nrows if nrows != ncols.
 
TMatrixTSparse< Element > & operator-=(Element val)
Subtract val from every element of the matrix.
 
TMatrixTBase< Element > & SetSub(Int_t row_lwb, Int_t col_lwb, const TMatrixTBase< Element > &source) override
Insert matrix source starting at [row_lwb][col_lwb], thereby overwriting the part [row_lwb....
 
void Allocate(Int_t nrows, Int_t ncols, Int_t row_lwb=0, Int_t col_lwb=0, Int_t init=0, Int_t nr_nonzeros=0)
Allocate new matrix.
 
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t nr_nonzeros=-1) override
Set size of the matrix to nrows x ncols with nr_nonzeros non-zero entries if nr_nonzeros > 0 .
 
void APlusB(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b, Int_t constr=0)
General matrix addition.
 
virtual TMatrixTSparse< Element > & RandomizePD(Element alpha, Element beta, Double_t &seed)
randomize matrix element values but keep matrix symmetric positive definite
 
TMatrixTBase< Element > & Zero() override
Set matrix elements to zero.
 
TMatrixTSparse< Element > & operator=(const TMatrixT< Element > &source)
Notice that the sparsity of the matrix is NOT changed : its fRowIndex/fColIndex are used !
 
Element operator()(Int_t rown, Int_t coln) const override
 
void ExtractRow(Int_t row, Int_t col, Element *v, Int_t n=-1) const override
Store in array v, n matrix elements of row rown starting at column coln.
 
TMatrixTBase< Element > & UnitMatrix() override
Make a unit matrix (matrix need not be a square one).
 
void conservative_sparse_sparse_product_impl(const TMatrixTSparse< Element > &lhs, const TMatrixTSparse< Element > &rhs, Int_t constr=0)
General Sparse Matrix Multiplication (SpMM).
 
Element RowNorm() const override
Row matrix norm, MAX{ SUM{ |M(i,j)|, over j}, over i}.
 
TMatrixTSparse< Element > & SetSparseIndexAB(const TMatrixTSparse< Element > &a, const TMatrixTSparse< Element > &b)
Set the row/column indices to the "sum" of matrices a and b It is checked that enough space has been ...
 
TObject & operator=(const TObject &rhs)
TObject assignment operator.
 
void ToUpper()
Change string to upper case.
 
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
 
RPY_EXPORTED TCppObject_t Allocate(TCppType_t type)
 
ELogLevel operator+(ELogLevel severity, int offset)
 
Long64_t LocMin(Long64_t n, const T *a)
Returns index of array with the minimum element.
 
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
 
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
 
Long64_t LocMax(Long64_t n, const T *a)
Returns index of array with the maximum element.
 
Double_t Sqrt(Double_t x)
Returns the square root of x.
 
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
 
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
 
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
 
void AMultBt(const Element *const ap, Int_t na, Int_t ncolsa, const Element *const bp, Int_t nb, Int_t ncolsb, Element *cp)
Elementary routine to calculate matrix multiplication A*B^T.
 
void AMultB(const Element *const ap, Int_t na, Int_t ncolsa, const Element *const bp, Int_t nb, Int_t ncolsb, Element *cp)
Elementary routine to calculate matrix multiplication A*B.
 
TMatrixT< Element > & ElementMult(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Multiply target by the source, element-by-element.
 
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
 
TMatrixT< Element > & ElementDiv(TMatrixT< Element > &target, const TMatrixT< Element > &source)
Divide target by the source, element-by-element.
 
Bool_t AreCompatible(const TMatrixTBase< Element1 > &m1, const TMatrixTBase< Element2 > &m2, Int_t verbose=0)
Check that matrice sm1 and m2 areboth valid and have identical shapes .
 
static uint64_t sum(uint64_t i)