Revision 1972 trunk/src/linad99/fvar.hpp

fvar.hpp (revision 1972)
637 637
   friend class ivector;
638 638
};
639 639

  
640
#include <ivector.h>
640 641

  
641 642
/**
642 643
 * Description not yet available.
643 644
 * \param
644 645
 */
645
class ivector
646
{
647
 protected:
648
   int index_min;
649
   int index_max;
650
   int *v;
651
   vector_shapex *shape;
652

  
653
 public:
654
   int allocated(void) const
655
   {
656
      return (shape != NULL);
657
   }
658

  
659
   ivector & operator --(void)
660
   {
661
      index_min--;
662
      index_max--;
663
      v++;
664
      return *this;
665
   }
666
   void reallocate(double size);
667

  
668
   ivector & operator ++(void)
669
   {
670
      index_min++;
671
      index_max++;
672
      v--;
673
      return *this;
674
   }
675
   friend class vector_index;
676
   int operator!(void) const
677
   {
678
      return (shape == NULL);
679
   }
680

  
681
   int &elem(int i)
682
   {
683
      return (v[i]);
684
   }
685
   const int &elem(int i) const
686
   {
687
      return v[i];
688
   }
689
   // returns the minimum allowable index
690
   int indexmin() const
691
   {
692
      return index_min;
693
   }
694
   // returns the maximum allowable index
695
   int indexmax() const
696
   {
697
      return index_max;
698
   }
699
   // returns the maximum allowable index
700
   int size() const
701
   {
702
      return index_max - index_min + 1;
703
   }
704
   int *get_v(void) const
705
   {
706
      return v;
707
   }
708
   ivector & shift(int min);
709
   //ivector(unsigned int sz); //makes an array [0..sz]
710
   //inline allocated(void) {return ::allocated(this);}
711
   ivector(const lvector &);
712
   ivector(void);
713

  
714
   ivector(const dvector &);
715

  
716
   void fill(const char *s);
717
   void fill_seqadd(int, int);
718
   void fill_multinomial(const int &seed, const dvector & p);
719
   void fill_multinomial(const random_number_generator & rng,
720
     const dvector & p);
721
   ivector(int ncl, int ncu);
722
   ivector(const ad_integer & ncl, const index_type & ncu);
723
   void allocate(const ad_integer & ncl, const index_type & ncu);
724
   // makes an array [ncl..ncu]
725

  
726
   ivector(unsigned int sz, long int *x);
727

  
728
   void safe_allocate(int ncl, int ncu);
729
   void allocate(int ncl, int ncu);
730
   void allocate(const ivector & iv);
731
   void allocate(const dvector & dv);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff