// InnerProduct computes a Eucledian inner product.
327135
func (e *Euclidean) InnerProduct(vectorX *mat.Dense, vectorY *mat.Dense) float64 {
	subVector := mat.NewDense(1, 1, nil)
	subVector.Reset()
	subVector.MulElem(vectorX, vectorY)
	result := mat.Sum(subVector)

	return result
}
564832
func (s *ListPhoneNumbersInput) SetProductType(v string) *ListPhoneNumbersInput {
	s.ProductType = &v
	return s
}
322157
func NewProductDiskAPI(client *Client) *ProductDiskAPI {
	return &ProductDiskAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "product/disk"
			},
		},
	}
}
36779
func (s *AwsSecurityFindingFilters) SetProductArn(v []*StringFilter) *AwsSecurityFindingFilters {
	s.ProductArn = v
	return s
}
109795
func (s *DeleteProvisioningArtifactInput) SetProductId(v string) *DeleteProvisioningArtifactInput {
	s.ProductId = &v
	return s
}
833755
func (s *DescribeReservedCacheNodesOfferingsInput) SetProductDescription(v string) *DescribeReservedCacheNodesOfferingsInput {
	s.ProductDescription = &v
	return s
}
1356662
func (p *asyncProducer) newBrokerProducer(broker *Broker) *brokerProducer {
	var (
		input     = make(chan *ProducerMessage)
		bridge    = make(chan *produceSet)
		responses = make(chan *brokerProducerResponse)
	)

	bp := &brokerProducer{
		parent:         p,
		broker:         broker,
		input:          input,
		output:         bridge,
		responses:      responses,
		buffer:         newProduceSet(p),
		currentRetries: make(map[string]map[int32]error),
	}
	go withRecover(bp.run)

	// minimal bridge to make the network response `select`able
	go withRecover(func() {
		for set := range bridge {
			request := set.buildRequest()

			response, err := broker.Produce(request)

			responses <- &brokerProducerResponse{
				set: set,
				err: err,
				res: response,
			}
		}
		close(responses)
	})

	if p.conf.Producer.Retry.Max <= 0 {
		bp.abandoned = make(chan struct{})
	}

	return bp
}
69222
func NewProductServerAPI(client *Client) *ProductServerAPI {
	return &ProductServerAPI{
		&baseAPI{
			client: client,
			// FuncGetResourceURL
			FuncGetResourceURL: func() string {
				return "product/server"
			},
		},
	}
}
1024552
func (slpp *softLayer_Product_Package_Service) filterProducts(array []*datatypes.Softlayer_Product_Package, predicate func(*datatypes.Softlayer_Product_Package) bool) []datatypes.Softlayer_Product_Package {
	filtered := make([]datatypes.Softlayer_Product_Package, 0)
	for _, element := range array {
		if predicate(element) {
			filtered = append(filtered, *element)
		}
	}
	return filtered
}
721873
func (s *Entitlement) SetProductCode(v string) *Entitlement {
	s.ProductCode = &v
	return s
}
633665
func (router *SimpleRouter) AddProducer(producers ...Producer) {
	for _, prod := range producers {
		for _, inListProd := range router.Producers {
			if inListProd == prod {
				return // ### return, already in list ###
			}
		}
		router.Producers = append(router.Producers, prod)
	}
}
1332639
func JSONProducer() Producer {
	return ProducerFunc(func(writer io.Writer, data interface{}) error {
		enc := json.NewEncoder(writer)
		enc.SetEscapeHTML(false)
		return enc.Encode(data)
	})
}
1189319
func (s *AwsSecurityFinding) SetProductArn(v string) *AwsSecurityFinding {
	s.ProductArn = &v
	return s
}
334234
func (s *DescribeAlgorithmOutput) SetProductId(v string) *DescribeAlgorithmOutput {
	s.ProductId = &v
	return s
}
1120873
func NewProducer(brokers []string, topic string, envMax int) (Producer, error) {
	config := sarama.NewConfig()
	if envMax > 0 {
		config.Producer.MaxMessageBytes = envMax
	}
	producer, err := sarama.NewAsyncProducer(brokers, config)
	if err != nil {
		return Producer{}, err
	}

	outputChannel := make(chan []byte)
	errorChannel := make(chan error)
	closerChannel := make(chan struct{})
	closedChannel := make(chan struct{})

	go func() {
		defer close(closedChannel)
		log.Info("Started kafka producer", log.Data{"topic": topic})
		for {
			select {
			case err := <-producer.Errors():
				log.ErrorC("Producer", err, log.Data{"topic": topic})
				errorChannel <- err
			case message := <-outputChannel:
				producer.Input() <- &sarama.ProducerMessage{Topic: topic, Value: sarama.StringEncoder(message)}
			case <-closerChannel:
				log.Info("Closing kafka producer", log.Data{"topic": topic})
				return
			}
		}
	}()

	return Producer{producer, outputChannel, errorChannel, closerChannel, closedChannel}, nil
}
1114301
func (s *RelatedFinding) SetProductArn(v string) *RelatedFinding {
	s.ProductArn = &v
	return s
}
348553
func (s *DescribeReservedDBInstancesInput) SetProductDescription(v string) *DescribeReservedDBInstancesInput {
	s.ProductDescription = &v
	return s
}