comparison liboctave/Array.h @ 14951:4c9fd3e31436

Start of jit support for double matricies
author Max Brister <max@2bass.com>
date Thu, 14 Jun 2012 16:38:06 -0500
parents 13cc11418393
children 50e9e02d7c0e
comparison
equal deleted inserted replaced
14950:7ab3ac5c676c 14951:4c9fd3e31436
161 // a static object instead. 161 // a static object instead.
162 162
163 static typename Array<T>::ArrayRep nr; 163 static typename Array<T>::ArrayRep nr;
164 return &nr; 164 return &nr;
165 } 165 }
166
167 protected:
168
169 // For jit support
170 Array (T *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep)
171 : dimensions (adims),
172 rep (reinterpret_cast<typename Array<T>::ArrayRep *> (arep)),
173 slice_data (sdata), slice_len (slen) {}
166 174
167 public: 175 public:
168 176
169 // Empty ctor (0x0). 177 // Empty ctor (0x0).
170 178
691 // Returns true if this->dims () == dv, and if so, replaces this->dimensions 699 // Returns true if this->dims () == dv, and if so, replaces this->dimensions
692 // by a shallow copy of dv. This is useful for maintaining several arrays with 700 // by a shallow copy of dv. This is useful for maintaining several arrays with
693 // supposedly equal dimensions (e.g. structs in the interpreter). 701 // supposedly equal dimensions (e.g. structs in the interpreter).
694 bool optimize_dimensions (const dim_vector& dv); 702 bool optimize_dimensions (const dim_vector& dv);
695 703
704 // WARNING: Only call these functions from jit
705
706 int *jit_ref_count (void) { return rep->count.get (); }
707
708 T *jit_slice_data (void) const { return slice_data; }
709
710 octave_idx_type *jit_dimensions (void) const { return dimensions.to_jit (); }
711
712 void *jit_array_rep (void) const { return rep; }
713
696 private: 714 private:
697 715
698 void resize2 (octave_idx_type nr, octave_idx_type nc, const T& rfv); 716 void resize2 (octave_idx_type nr, octave_idx_type nc, const T& rfv);
699 void resize2 (octave_idx_type nr, octave_idx_type nc) 717 void resize2 (octave_idx_type nr, octave_idx_type nc)
700 { 718 {