Menu

[r193]: / trunk / include / misc / dcomponent.hpp  Maximize  Restore  History

Download this file

51 lines (44 with data), 2.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//=============================================================================
//! Component Class for Real Double-precision Sparse Matrix Classes
class dcomponent
{
public:
///////////////////////////////////////////////
/////////////////// objects ///////////////////
///////////////////////////////////////////////
CPPL_INT i; //!< i index of the component
CPPL_INT j; //!< j index of the component
double v; //!< value of the component
///////////////////////////////////////////////
///////////////// constructors ////////////////
///////////////////////////////////////////////
inline dcomponent(){ ; }
inline dcomponent(const CPPL_INT& _i, const CPPL_INT& _j, const double& _v) :i(_i), j(_j), v(_v){ ; }
///////////////////////////////////////////////
////////////////// functions //////////////////
///////////////////////////////////////////////
inline friend std::ostream& operator<<(std::ostream&, const dcomponent&);
inline static bool ilt(const dcomponent&, const dcomponent&);
inline static bool jlt(const dcomponent&, const dcomponent&);
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//=============================================================================
inline std::ostream& operator<<(std::ostream& s, const dcomponent& c)
{CPPL_VERBOSE_REPORT;
s << "(" << c.i << ", " << c.j << ", " << c.v << ")" << std::flush;
return s;
}
//=============================================================================
/*! lessthan function for i of dcomponent */
inline bool dcomponent::ilt(const dcomponent& a, const dcomponent& b)
{CPPL_VERBOSE_REPORT;
return a.i < b.i;
}
//=============================================================================
/*! lessthan function for j of dcomponent */
inline bool dcomponent::jlt(const dcomponent& a, const dcomponent& b)
{CPPL_VERBOSE_REPORT;
return a.j < b.j;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.