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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
macro_rules! define_generic_operations_forward {
	(from: $name:ident, to: $gen_type:ident, $($data_type:ident),*)
	 =>
	 {
         $(
            impl GenericVectorOperations<$data_type> for $name<$data_type>
            {
                fn add_vector(self, summand: &Self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().add_vector(&summand.to_gen_borrow()))
                }
                
                fn add_smaller_vector(self, summand: &Self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().add_smaller_vector(&summand.to_gen_borrow()))
                }
        
                fn subtract_vector(self, subtrahend: &Self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().subtract_vector(&subtrahend.to_gen_borrow()))
                }
                
                fn subtract_smaller_vector(self, subtrahend: &Self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().subtract_smaller_vector(&subtrahend.to_gen_borrow()))
                }
                
                fn multiply_vector(self, factor: &Self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().multiply_vector(&factor.to_gen_borrow()))
                }
                
                fn multiply_smaller_vector(self, factor: &Self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().multiply_smaller_vector(&factor.to_gen_borrow()))
                }
                
                fn divide_vector(self, divisor: &Self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().divide_vector(&divisor.to_gen_borrow()))
                }
                
                fn divide_smaller_vector(self, divisor: &Self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().divide_smaller_vector(&divisor.to_gen_borrow()))
                }
                
                fn zero_pad(self, points: usize, option: PaddingOption) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().zero_pad(points, option))
                }
                
                fn reverse(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().reverse())
                }
                
                fn zero_interleave(self, factor: u32) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().zero_interleave(factor))
                }
                
                fn diff(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().diff())
                }
                
                fn diff_with_start(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().diff_with_start())
                }
                
                fn cum_sum(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().cum_sum())
                }
                
                fn sqrt(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().sqrt()) 
                }
                
                fn square(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().square()) 
                }
                
                fn root(self, degree: $data_type) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().root(degree)) 
                }
                
                fn power(self, exponent: $data_type) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().power(exponent)) 
                }
                
                fn logn(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().logn()) 
                }
                
                fn expn(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().expn()) 
                }
            
                fn log_base(self, base: $data_type) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().log_base(base)) 
                }
                
                fn sin(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().sin()) 
                }
                
                fn cos(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().cos()) 
                }
    
                fn tan(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().tan()) 
                }
                
                fn asin(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().asin()) 
                }
               
                fn acos(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().acos()) 
                }
                
                fn atan(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().atan()) 
                }
                
                fn sinh(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().sinh()) 
                }
                
                fn cosh(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().cosh()) 
                }
                
                fn tanh(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().tanh()) 
                }
                
                fn asinh(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().asinh()) 
                }
                
                fn acosh(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().acosh()) 
                }
                
                fn atanh(self) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().atanh()) 
                }
                
                fn swap_halves(self) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().swap_halves()) 
                }
                
                fn exp_base(self, base: $data_type) -> VecResult<Self>
                {
                    Self::from_genres(self.to_gen().exp_base(base)) 
                }
                
                fn override_data(self, data: &[$data_type]) -> VecResult<Self> {
                    Self::from_genres(self.to_gen().override_data(data))
                }
                
                fn split_into(&self, targets: &mut [Box<Self>]) -> VoidResult {
                    unsafe { 
                        self.to_gen_borrow().split_into(mem::transmute(targets))
                    }
                }
                
                fn merge(self, sources: &[Box<Self>]) -> VecResult<Self> {
                    unsafe { 
                        Self::from_genres(self.to_gen().merge(mem::transmute(sources)))
                    }
                }
            }
       )*
	}	
}