~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/mod/mth/shl/Rsi.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ---------------------------------------------------------------------------
 
2
// - Rsi.hpp                                                                 -
 
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.                  -
 
7
// -                                                                         -
 
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
// ---------------------------------------------------------------------------
 
16
 
 
17
#ifndef  AFNIX_RSI_HPP
 
18
#define  AFNIX_RSI_HPP
 
19
 
 
20
#ifndef  AFNIX_OBJECT_HPP
 
21
#include "Object.hpp"
 
22
#endif
 
23
 
 
24
namespace afnix {
 
25
 
 
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
 
31
 
 
32
  class Rsi : public virtual Object {
 
33
  protected:
 
34
    /// the sparsity size
 
35
    t_long d_size;
 
36
 
 
37
  public:
 
38
    /// create a null sparse object
 
39
    Rsi (void);
 
40
 
 
41
    /// create a sparse object by size
 
42
    /// @param size the vector size
 
43
    Rsi (const t_long size);
 
44
 
 
45
    /// @return the sparse object size
 
46
    virtual t_long getsize (void) const;
 
47
 
 
48
    /// @return the sparse object length
 
49
    virtual t_long length (void) const =0;
 
50
      
 
51
    /// get a sparse index by position
 
52
    /// @param pos the position index
 
53
    virtual t_long getidx (const t_long pos) const =0;
 
54
 
 
55
    /// get a sparse value by position
 
56
    /// @param pos the position index
 
57
    virtual t_real getval (const t_long pos) const =0;
 
58
 
 
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;
 
64
 
 
65
  public:
 
66
    /// @return true if the given quark is defined
 
67
    bool isquark (const long quark, const bool hflg) const;
 
68
 
 
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,
 
75
                   Vector* argv);
 
76
  };
 
77
}
 
78
 
 
79
#endif