1
// ---------------------------------------------------------------------------
3
// - afnix:mth module - real sparse interface definitions -
4
// ---------------------------------------------------------------------------
5
// - This program is free software; you can redistribute it and/or modify -
6
// - it provided that this copyright notice is kept intact. -
8
// - This program is distributed in the hope that it will be useful, but -
9
// - without any warranty; without even the implied warranty of -
10
// - merchantability or fitness for a particular purpose. In no event shall -
11
// - the copyright holder be liable for any direct, indirect, incidental or -
12
// - special damages arising in any way out of the use of this software. -
13
// ---------------------------------------------------------------------------
14
// - copyright (c) 1999-2011 amaury darsch -
15
// ---------------------------------------------------------------------------
20
#ifndef AFNIX_OBJECT_HPP
26
/// This Rsi class is an abstract class that models the behavior of a
27
/// real sparse vector. The class is not designed to be mutated and
28
/// therefore does not provide all of the vector methods. The sparsity
29
/// is merely designed here for storing real indexed value.
30
/// @author amaury darsch
32
class Rsi : public virtual Object {
38
/// create a null sparse object
41
/// create a sparse object by size
42
/// @param size the vector size
43
Rsi (const t_long size);
45
/// @return the sparse object size
46
virtual t_long getsize (void) const;
48
/// @return the sparse object length
49
virtual t_long length (void) const =0;
51
/// get a sparse index by position
52
/// @param pos the position index
53
virtual t_long getidx (const t_long pos) const =0;
55
/// get a sparse value by position
56
/// @param pos the position index
57
virtual t_real getval (const t_long pos) const =0;
59
/// set a sparse entry by index and value
60
/// @param sidx the sparse index to set
61
/// @param sval the sparse value to set
62
/// @return the sparse position
63
virtual t_long set (const t_long sidx, const t_real sval) =0;
66
/// @return true if the given quark is defined
67
bool isquark (const long quark, const bool hflg) const;
69
/// apply this object with a set of arguments and a quark
70
/// @param robj the current runnable
71
/// @param nset the current nameset
72
/// @param quark the quark to apply these arguments
73
/// @param argv the arguments to apply
74
Object* apply (Runnable* robj, Nameset* nset, const long quark,