parameters: (self, name, signature)
return_statement: return False
docstring: Checks if the given math intrinsic is supported.
docstring_summary: Checks if the given math intrinsic is supported.
docstring_tokens: Checks if the given math intrinsic is supported .
function: def is_math_supported(self, name, signature):
  		"""Checks if the given math intrinsic is supported."""
  		ret_type, params = self.split_signature(signature)
  
  		base = None
  		dim  = 0
  		vt = self.get_vector_type_and_size(ret_type)
  		if vt:
  			base = vt[0]
  			dim  = vt[1]
  
  		all_atomic    = self.is_atomic_type(ret_type)
  		all_base_same = base != None
  		for param in params:
  			if not self.is_atomic_type(param):
  				all_atomic = False
  			if self.m_inv_types[param] != base:
  				vt = self.get_vector_type_and_size(param)
  				if not vt or vt[0] != base or vt[1] != dim:
  					all_base_same = False
  
  		if len(params) == 3:
  			if name == "lerp":
  				# support lerp with 3 arguments
  				self.intrinsic_modes[name + signature] = "math::lerp"
  				return True
  		elif len(params) == 2:
  			if name == "dot":
  				# support dot with 2 arguments
  				self.intrinsic_modes[name + signature] = "math::dot"
  				return True
  			elif name == "step":
  				# support step with 2 arguments
  				self.intrinsic_modes[name + signature] = "math::step"
  				return True
  			elif name == "distance":
  				# support distance(floatX)
  				self.intrinsic_modes[name + signature] = "math::distance"
  				return True
  			elif name == "emission_color":
  				# support emission_color(float[<N>], float[N])
  				self.intrinsic_modes[name + signature] = "math::emission_color"
  				return True
  			elif name == "eval_at_wavelength":
  				# support eval_at_wavelength(color,float)
  				self.intrinsic_modes[name + signature] = "math::eval_at_wavelength"
  				return True
  		elif len(params) == 1:
  			if name == "any" or name == "all":
  				# support any and all with one argument
  				self.intrinsic_modes[name + signature] = "math::any|all"
  				return True
  			if name == "average":
  				# support average with one argument
  				self.intrinsic_modes[name + signature] = "math::average"
  				return True
  			elif name == "degrees":
  				# support degrees with 1 argument
  				self.intrinsic_modes[name + signature] = "math::const_mul"
  				self.cnst_mul[name] = "180.0 / M_PI"
  				return True
  			elif name == "radians":
  				# support radians with 1 argument
  				self.intrinsic_modes[name + signature] = "math::const_mul"
  				self.cnst_mul[name] = "M_PI / 180.0"
  				return True
  			elif name == "min_value" or name == "max_value":
  				# support min_value/max_value with 1 argument
  				self.intrinsic_modes[name + signature] = "math::min_value|max_value"
  				return True
  			elif name == "min_value_wavelength" or name == "max_value_wavelength":
  				# support min_value_wavelength/max_value_wavelength with 1 argument
  				self.intrinsic_modes[name + signature] = "math::min_value_wavelength|max_value_wavelength"
  				return True
  			elif name == "isnan" or name == "isfinite":
  				if self.get_vector_type_and_size(params[0]) or self.is_atomic_type(params[0]):
  					# support all isnan/isfinite with one argument
  					self.intrinsic_modes[name + signature] = "math::isnan|isfinite"
  					return True
  			elif name == "blackbody":
  				# support blackbody with 1 argument
  				self.intrinsic_modes[name + signature] = "math::blackbody"
  				return True
  			elif name == "emission_color":
  				# supported emission_color(color)
  				self.intrinsic_modes[name + signature] = "math::first_arg"
  				return True
  			elif name == "length":
  				# support length(floatX)
  				self.intrinsic_modes[name + signature] = "math::length"
  				return True
  			elif name == "normalize":
  				# support normalize(floatX)
  				self.intrinsic_modes[name + signature] = "math::normalize"
  				return True
  			elif name == "DX" or name == "DY":
  				# support DX(floatX), DY(floatX)
  				self.intrinsic_modes[name + signature] = "math::DX|DY"
  				return True
  
  		if all_atomic and self.is_atomic_type(ret_type):
  			# simple all float/int/bool functions
  			self.intrinsic_modes[name + signature] = "math::all_atomic"
  			return True
  
  		if len(params) == 1:
  			if name == "luminance":
  				if params[0] == "F3" or params[0] == "CC":
  					# support luminance(float3) and luminance(color)
  					self.intrinsic_modes[name + signature] = "math::luminance"
  					return True
  			elif name == "transpose":
  				if self.get_matrix_type_kind(params[0]):
  					# support transpose(floatX)
  					self.intrinsic_modes[name + signature] = "math::transpose"
  					return True
  
  		if name == "cross":
  			if signature == "F3_F3_F3" or signature == "D3_D3_D3":
  				# the only supported cross variant
  				self.intrinsic_modes[name + signature] = "math::cross"
  				return True
  			else:
  				return False
  
  		if name == "sincos":
  			if len(params) == 1:
  				arg_tp = params[0]
  				if self.is_float_type(arg_tp):
  					# support sincos for float types
  					self.intrinsic_modes[name + signature] = "math::sincos"
  					return True
  				vt = self.get_vector_type_and_size(arg_tp)
  				if vt and (vt[0] == "float" or vt[0] == "double"):
  					# support sincos for float vector types
  					self.intrinsic_modes[name + signature] = "math::sincos"
  					return True
  			return False
  
  		if name == "modf":
  			if len(params) == 1:
  				arg_tp = params[0]
  				if self.is_float_type(arg_tp):
  					# support modf for float types
  					self.intrinsic_modes[name + signature] = "math::modf"
  					return True
  				vt = self.get_vector_type_and_size(arg_tp)
  				if vt and (vt[0] == "float" or vt[0] == "double"):
  					# support modf for float vector types
  					self.intrinsic_modes[name + signature] = "math::modf"
  					return True
  			return False
  
  		if all_base_same:
  			# assume component operation
  			self.intrinsic_modes[name + signature] = "math::component_wise"
  			return True
  
  		return False
function_tokens: def is_math_supported ( self , name , signature ) : ret_type , params = self . split_signature ( signature ) base = None dim = 0 vt = self . get_vector_type_and_size ( ret_type ) if vt : base = vt [ 0 ] dim = vt [ 1 ] all_atomic = self . is_atomic_type ( ret_type ) all_base_same = base != None for param in params : if not self . is_atomic_type ( param ) : all_atomic = False if self . m_inv_types [ param ] != base : vt = self . get_vector_type_and_size ( param ) if not vt or vt [ 0 ] != base or vt [ 1 ] != dim : all_base_same = False if len ( params ) == 3 : if name == "lerp" : # support lerp with 3 arguments self . intrinsic_modes [ name + signature ] = "math::lerp" return True elif len ( params ) == 2 : if name == "dot" : # support dot with 2 arguments self . intrinsic_modes [ name + signature ] = "math::dot" return True elif name == "step" : # support step with 2 arguments self . intrinsic_modes [ name + signature ] = "math::step" return True elif name == "distance" : # support distance(floatX) self . intrinsic_modes [ name + signature ] = "math::distance" return True elif name == "emission_color" : # support emission_color(float[<N>], float[N]) self . intrinsic_modes [ name + signature ] = "math::emission_color" return True elif name == "eval_at_wavelength" : # support eval_at_wavelength(color,float) self . intrinsic_modes [ name + signature ] = "math::eval_at_wavelength" return True elif len ( params ) == 1 : if name == "any" or name == "all" : # support any and all with one argument self . intrinsic_modes [ name + signature ] = "math::any|all" return True if name == "average" : # support average with one argument self . intrinsic_modes [ name + signature ] = "math::average" return True elif name == "degrees" : # support degrees with 1 argument self . intrinsic_modes [ name + signature ] = "math::const_mul" self . cnst_mul [ name ] = "180.0 / M_PI" return True elif name == "radians" : # support radians with 1 argument self . intrinsic_modes [ name + signature ] = "math::const_mul" self . cnst_mul [ name ] = "M_PI / 180.0" return True elif name == "min_value" or name == "max_value" : # support min_value/max_value with 1 argument self . intrinsic_modes [ name + signature ] = "math::min_value|max_value" return True elif name == "min_value_wavelength" or name == "max_value_wavelength" : # support min_value_wavelength/max_value_wavelength with 1 argument self . intrinsic_modes [ name + signature ] = "math::min_value_wavelength|max_value_wavelength" return True elif name == "isnan" or name == "isfinite" : if self . get_vector_type_and_size ( params [ 0 ] ) or self . is_atomic_type ( params [ 0 ] ) : # support all isnan/isfinite with one argument self . intrinsic_modes [ name + signature ] = "math::isnan|isfinite" return True elif name == "blackbody" : # support blackbody with 1 argument self . intrinsic_modes [ name + signature ] = "math::blackbody" return True elif name == "emission_color" : # supported emission_color(color) self . intrinsic_modes [ name + signature ] = "math::first_arg" return True elif name == "length" : # support length(floatX) self . intrinsic_modes [ name + signature ] = "math::length" return True elif name == "normalize" : # support normalize(floatX) self . intrinsic_modes [ name + signature ] = "math::normalize" return True elif name == "DX" or name == "DY" : # support DX(floatX), DY(floatX) self . intrinsic_modes [ name + signature ] = "math::DX|DY" return True if all_atomic and self . is_atomic_type ( ret_type ) : # simple all float/int/bool functions self . intrinsic_modes [ name + signature ] = "math::all_atomic" return True if len ( params ) == 1 : if name == "luminance" : if params [ 0 ] == "F3" or params [ 0 ] == "CC" : # support luminance(float3) and luminance(color) self . intrinsic_modes [ name + signature ] = "math::luminance" return True elif name == "transpose" : if self . get_matrix_type_kind ( params [ 0 ] ) : # support transpose(floatX) self . intrinsic_modes [ name + signature ] = "math::transpose" return True if name == "cross" : if signature == "F3_F3_F3" or signature == "D3_D3_D3" : # the only supported cross variant self . intrinsic_modes [ name + signature ] = "math::cross" return True else : return False if name == "sincos" : if len ( params ) == 1 : arg_tp = params [ 0 ] if self . is_float_type ( arg_tp ) : # support sincos for float types self . intrinsic_modes [ name + signature ] = "math::sincos" return True vt = self . get_vector_type_and_size ( arg_tp ) if vt and ( vt [ 0 ] == "float" or vt [ 0 ] == "double" ) : # support sincos for float vector types self . intrinsic_modes [ name + signature ] = "math::sincos" return True return False if name == "modf" : if len ( params ) == 1 : arg_tp = params [ 0 ] if self . is_float_type ( arg_tp ) : # support modf for float types self . intrinsic_modes [ name + signature ] = "math::modf" return True vt = self . get_vector_type_and_size ( arg_tp ) if vt and ( vt [ 0 ] == "float" or vt [ 0 ] == "double" ) : # support modf for float vector types self . intrinsic_modes [ name + signature ] = "math::modf" return True return False if all_base_same : # assume component operation self . intrinsic_modes [ name + signature ] = "math::component_wise" return True return False