Esempio n. 1
0
	def __mul__(self,g):

		'''inner product of two  basis functions'''

		# calculate the inner product.

		assert (g.base == 'scale' or g.base=='wavelet'), 'inner product error'
		
		if ((g.base is 'scale' and self.j>=g.j) or (g.base is 'wavelet' and self.j<>g.j)):temp_mul=0; return temp_mul	
		elif max((self.Supp()[0],g.Supp()[0])) >= min((self.Supp()[1],g.Supp()[1])):temp_mul=0; return temp_mul	

		else:	


			j_max=np.max((self.j,g.j)) 
			j_min=np.min((self.j,g.j)) 

			if j_min==self.j:k_max=self.k;k_min=g.k
			else: k_min=self.k;k_max=g.k		


			self_temp=TransformCoefficients['TQ'+str(j_max+1-self.j)]	
			g_temp=	TransformCoefficients['T'+g.name+str(j_max+1-g.j)]

		

			temp_len_min=np.min((self_temp.shape[1],g_temp.shape[1]))
			temp_len_max=np.max((self_temp.shape[1],g_temp.shape[1]))
			

			if temp_len_min==self_temp.shape[1]:Matrix_In=self_temp;Matrix_out=g_temp 
			else:Matrix_In=g_temp;Matrix_out=self_temp 

			Incoefs_temp=np.zeros((temp_len_min+temp_len_max-1,temp_len_max))
			for n in range(temp_len_max):
				m=0
				for i in range(n,n+temp_len_min):
					Incoefs_temp[i,n]=Matrix_In[0,m]
					m+=1
			Incoefs=np.dot(Incoefs_temp,Matrix_out.T)
			#Calculate inner product
			start=5-Matrix_In.shape[1]
			stop=4+Matrix_out.shape[1]		
			temp_mul=0
			b8=spline.spline8(0,0)	

	

			for i in range(start,stop):
				temp_mul+=Incoefs[i-start]*b8(i+(2**(j_max+1-j_min))*(k_max)-2*k_min)
			return float(temp_mul*(1./(2**(j_max+1)))*(2**(self.j/2.))*(2**(g.j/2.)))
Esempio n. 2
0
	def __call__(self,s):

		#This is to find maximum resolution.
		j_max=np.max((self.j1,self.j2)) 
		#This is to find minimum resolution.
		j_min=np.min((self.j1,self.j2)) 

		if j_min==self.j1:k_max=self.k1;k_min=self.k2          
		else: k_min=self.k1;k_max=self.k2                     


		temp_1=TransformCoefficients['T'+self.name1+str(j_max+1-self.j1)]	
		temp_2=TransformCoefficients['T'+self.name2+str(j_max+1-self.j2)]

		

		temp_len_min=np.min((temp_1.shape[1],temp_2.shape[1]))
		temp_len_max=np.max((temp_1.shape[1],temp_2.shape[1]))


		if temp_len_min==temp_1.shape[1]:Matrix_In=temp_1;Matrix_out=temp_2 
		else:Matrix_In=temp_2;Matrix_out=temp_1 

		Concoefs_temp=np.zeros((temp_len_min+temp_len_max-1,temp_len_max))
		for n in range(temp_len_max):
			m=0
			for i in range(n,n+temp_len_min):
				Concoefs_temp[i,n]=Matrix_In[0,m]
				m+=1
		Concoefs=np.dot(Concoefs_temp,Matrix_out.T)

		
		weights=Concoefs					    
		l=(2**(j_max+1-j_min))*(k_max)+2*k_min  		     
		f=[spline.spline8(j_max+1,j+l) for j in range(weights.shape[0])] 
		k=IDEComponents.spline8(1,f,weights)  			     
		return (1./2**(j_max+1))*k(s)*(2**(self.j1/2.))*(2**(self.j2/2.))