// InnerProduct computes the inner product through a kernel trick
// K(x, y) = (x^T y + 1)^d
333569
func (p *PolyKernel) InnerProduct(vectorX *mat.Dense, vectorY *mat.Dense) float64 {
	subVectorX := vectorX.ColView(0)
	subVectorY := vectorY.ColView(0)
	result := mat.Dot(subVectorX, subVectorY)
	result = math.Pow(result+1, float64(p.degree))

	return result
}
691530
func (s *ReservedCacheNode) SetProductDescription(v string) *ReservedCacheNode {
	s.ProductDescription = &v
	return s
}
550585
func (contract *Contract) GetProducts() (*Products, error) {
	req, err := client.NewRequest(
		Config,
		"GET",
		fmt.Sprintf(
			"/papi/v1/products?contractId=%s",
			contract.ContractID,
		),
		nil,
	)
	if err != nil {
		return nil, err
	}

	res, err := client.Do(Config, req)
	if err != nil {
		return nil, err
	}

	if client.IsError(res) {
		return nil, client.NewAPIError(res)
	}

	products := NewProducts()
	if err = client.BodyJSON(res, products); err != nil {
		return nil, err
	}

	return products, nil
}
721873
func (s *Entitlement) SetProductCode(v string) *Entitlement {
	s.ProductCode = &v
	return s
}
316602
func (s *CreateConstraintInput) SetProductId(v string) *CreateConstraintInput {
	s.ProductId = &v
	return s
}
93586
func (s *UpdatePhoneNumberRequestItem) SetProductType(v string) *UpdatePhoneNumberRequestItem {
	s.ProductType = &v
	return s
}
866531
func YAMLProducer() runtime.Producer {
	return runtime.ProducerFunc(func(w io.Writer, v interface{}) error {
		b, _ := yaml.Marshal(v) // can't make this error come up
		_, err := w.Write(b)
		return err
	})
}
75442
func (s *ConfigurationParser) FindByProductID(id string) (productResponse Products, err error) {
	productResponse, err = s.InstallationSettings.FindByProductID(id)
	return
}
460879
func (v Vector) DotProduct(v2 Vector) (result float64, err error) {
	if len(v) != len(v2) {
		err = ErrDimensionMismatch
		return
	}

	for i := 0; i < len(v); i++ {
		result = result + (v[i] * v2[i])
	}
	return
}
489916
func (r *RegistrationDB) AddProducer(k Registration, p *Producer) bool {
	r.Lock()
	defer r.Unlock()
	_, ok := r.registrationMap[k]
	if !ok {
		r.registrationMap[k] = make(map[string]*Producer)
	}
	producers := r.registrationMap[k]
	_, found := producers[p.peerInfo.id]
	if found == false {
		producers[p.peerInfo.id] = p
	}
	return !found
}
549101
func (s *FailedServiceActionAssociation) SetProductId(v string) *FailedServiceActionAssociation {
	s.ProductId = &v
	return s
}
322157
func NewProductDiskAPI(client *Client) *ProductDiskAPI {
	return &ProductDiskAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "product/disk"
			},
		},
	}
}
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)
	}
}
590180
func (s *Severity) SetProduct(v float64) *Severity {
	s.Product = &v
	return s
}
762683
func ProductConstraint(attr ...IntegerAttribute) ArithmeticConstraint {
	attribute := make([]Attribute, len(attr))
	for i, a := range attr {
		attribute[i] = Attribute(a)
	}
	return NewArithmeticConstraint(MULT_OP, attribute, nil)
}
393621
func SuggestedProduct(s string, num uint) string {
	var n int
	var val, flair string
	if num > 0 {
		n = rand.Intn(3)
		switch n {
		case 0, 1:
			flair = ", then"
		case 2: // do nothing
		}
	}
	n = rand.Intn(6)
	switch n {
	case 0:
		val = "I found just the thing"
	case 1:
		val = "This is the one for you"
	case 2:
		val = "You'll love this"
	case 3:
		val = "This is a real treat"
	case 4:
		val = "This will amaze you"
	case 5:
		val = "I found just the thing for you"
	}
	return val + flair + ". " + s
}
796297
public static double innerProduct( double a[] , int offsetA ,
                                       DMatrix1Row B ,
                                       double c[] , int offsetC )
    {
        if( a.length-offsetA < B.numRows)
            throw new IllegalArgumentException("Length of 'a' isn't long enough");
        if( c.length-offsetC < B.numCols)
            throw new IllegalArgumentException("Length of 'c' isn't long enough");

        int cols = B.numCols;
        double output = 0;

        for (int k = 0; k < B.numCols; k++) {
            double sum = 0;
            for (int i = 0; i < B.numRows; i++) {
                sum += a[offsetA+i]*B.data[k+i*cols];
            }
            output += sum*c[offsetC+k];
        }

        return output;
    }