// The SKU of the product. Product index must be a positive
// integer between 1 and 200, inclusive. For analytics.js the
// Enhanced Ecommerce plugin must be installed before using
// this field.
353893
func (h *Client) ProductSKU(productSKU string) *Client {
	h.productSKU = productSKU
	h.productSKUSet = true
	return h
}
284364
func Cor(x, y Vector) (float64, error) {
	n := float64(len(x))
	xy, err := Product(x, y)
	if err != nil {
		return NA, err
	}

	sx := x.Sd()
	sy := y.Sd()

	mx := x.Mean()
	my := y.Mean()

	r := (xy.Sum() - n*mx*my) / ((n - 1) * sx * sy)
	return r, nil
}
704137
func parseProduct(product []byte) (string, string) {
	prod := strings.SplitN(string(product), "/", 2)
	if len(prod) == 2 {
		return prod[0], prod[1]
	}
	return string(product), ""
}
926496
func (metadata *IndexMetadata) hasProduct(prodIds []string) bool {
	for _, pid := range metadata.ProductIds {
		if containsString(prodIds, pid) {
			return true
		}
	}
	return false
}
384968
func GetPriceIDByPackageIdandLocationGroups(sess *session.Session, locationGroupIds []int, packageid int, addon string) (int, error) {
	productpackageservice := services.GetProductPackageService(sess)
	productpackageservicefilter := strings.Replace(`{"items":{"description":{"operation":"appliance"}}}`, "appliance", addon, -1)
	productpackageservicemask := "description,prices.locationGroupId,prices.id"
	resp, err := productpackageservice.Mask(productpackageservicemask).Filter(productpackageservicefilter).Id(packageid).GetItems()
	if err != nil {
		return 0, err
	}
	m := make(map[int]int)
	if len(locationGroupIds) == 0 {
		locationGroupIds = append(locationGroupIds, 1)
	}
	for _, item := range locationGroupIds {
		for _, items := range resp {
			for _, temp := range items.Prices {
				if temp.LocationGroupId == nil {
					m[item] = *temp.Id
				} else if item == *temp.LocationGroupId {
					m[*temp.LocationGroupId] = *temp.Id
				}
			}
		}
		if val, ok := m[item]; ok {
			return val, nil
		}
	}
	return 0, nil
}
296401
func (r Hardware_Router) GetUpgradeItemPrices() (resp []datatypes.Product_Item_Price, err error) {
	err = r.Session.DoRequest("SoftLayer_Hardware_Router", "getUpgradeItemPrices", nil, &r.Options, &resp)
	return
}
99864
func (c *ProductClient) Get(ctx context.Context, label string) (*ResolvedProduct, error) {
	p := fmt.Sprintf("/product/%s", label)

	req, err := c.backend.NewRequest(http.MethodGet, p, nil, nil)
	if err != nil {
		return nil, err
	}

	var resp ResolvedProduct
	_, err = c.backend.Do(ctx, req, &resp, func(code int) error {
		switch code {
		case 400, 404, 500:
			return &Error{}
		default:
			return nil
		}
	})
	if err != nil {
		return nil, err
	}

	return &resp, nil
}
93586
func (s *UpdatePhoneNumberRequestItem) SetProductType(v string) *UpdatePhoneNumberRequestItem {
	s.ProductType = &v
	return s
}
293009
func (r Product_Item_Price) GetPackageReferences() (resp []datatypes.Product_Package_Item_Prices, err error) {
	err = r.Session.DoRequest("SoftLayer_Product_Item_Price", "getPackageReferences", nil, &r.Options, &resp)
	return
}
808127
func (metadata *CloudMetadata) extractCatalogsForProducts(productIds []string) []MetadataCatalog {
	result := []MetadataCatalog{}
	for _, id := range productIds {
		if catalog, ok := metadata.Products[id]; ok {
			result = append(result, catalog)
		}
	}
	return result
}
564832
func (s *ListPhoneNumbersInput) SetProductType(v string) *ListPhoneNumbersInput {
	s.ProductType = &v
	return s
}
36545
func NewMedPriceWithoutStorage(valueAvailableAction ValueAvailableActionFloat) (indicator *MedPriceWithoutStorage, err error) {

	// an indicator without storage MUST have a value available action
	if valueAvailableAction == nil {
		return nil, ErrValueAvailableActionIsNil
	}

	lookback := 0
	ind := MedPriceWithoutStorage{
		baseIndicatorWithFloatBounds: newBaseIndicatorWithFloatBounds(lookback, valueAvailableAction),
	}

	return &ind, nil
}
1149989
func (s *Settings) productEnv(family, product string) {
	eProduct := strings.ToUpper(family) + "_" + strings.ToUpper(product) + "_"
	s.commonEnv(eProduct)
}
65067
func (s *SKU) UnmarshalJSON(data []byte) error {
	if id, ok := ParseID(data); ok {
		s.ID = id
		return nil
	}

	type sku SKU
	var v sku
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}

	*s = SKU(v)
	return nil
}
312981
func (r Product_Item_Price) GetBareMetalReservedCapacityFlag() (resp bool, err error) {
	err = r.Session.DoRequest("SoftLayer_Product_Item_Price", "getBareMetalReservedCapacityFlag", nil, &r.Options, &resp)
	return
}
234941
func (r Product_Package) GetActiveItems() (resp []datatypes.Product_Item, err error) {
	err = r.Session.DoRequest("SoftLayer_Product_Package", "getActiveItems", nil, &r.Options, &resp)
	return
}
418736
func NewBuyType(s string) (buyType, error) {
	var e buyType
	err := e.FromString(s)
	if err != nil {
		return 0, err
	}
	return e, nil
}