Array of scalars
163192
function setValue1fv( gl, v ) {

	var cache = this.cache;

	if ( arraysEqual( cache, v ) ) return;

	gl.uniform1fv( this.addr, v );

	copyArray( cache, v );

}
678890
public Vector2f mul(float scalar, Vector2f dest) {
        dest.x = x * scalar;
        dest.y = y * scalar;
        return dest;
    }
1213627
async def scalar(self, query, *multiparams, **params):
        """"""
        res = await self.execute(query, *multiparams, **params)
        return (await res.scalar())
741646
def unpack_scalar(cls, dataset, data):
        
        if len(data) != 1 or len(data.columns) > 1:
            return data
        return data.iat[0,0]
315244
public static void scale(double scalar, DMatrixSparseCSC A, DMatrixSparseCSC B) {
        if( A != B ) {
            B.copyStructure(A);

            for(int i = 0; i < A.nz_length; i++ ) {
                B.nz_values[i] = A.nz_values[i]*scalar;
            }
        } else {
            for(int i = 0; i < A.nz_length; i++ ) {
                B.nz_values[i] *= scalar;
            }
        }
    }
294839
public Vector2d mul(double scalar, Vector2d dest) {
        dest.x = x * scalar;
        dest.y = y * scalar;
        return dest;
    }
1068121
@Override
    public INDArray scalar(float value) {
        if (Nd4j.dataType() == DataType.FLOAT || Nd4j.dataType() == DataType.HALF)
            return create(new float[] {value}, new int[0], new int[0], 0);
        else if (Nd4j.dataType() == DataType.DOUBLE)
            return scalar((double) value);
        else
            return scalar((int) value);
    }
378541
protected function multiplyScalar($scalar) : self
    {
        if (!is_int($scalar) and !is_float($scalar)) {
            throw new InvalidArgumentException('Scalar must be an integer'
                . ' or float, ' . gettype($scalar) . ' found.');
        }

        if ($scalar == 0) {
            return self::zeros(...$this->shape());
        }

        $b = [];

        foreach ($this->a as $row) {
            $temp = [];

            foreach ($row as $value) {
                $temp[] = $value * $scalar;
            }

            $b[] = $temp;
        }

        return self::quick($b);
    }
154434
function normalize( x ) {
	if (
		x !== x ||
		x === pinf ||
		x === ninf
	) {
		return [ x, 0 ];
	}
	if ( x !== 0 && abs( x ) < SMALLEST_FLOAT32 ) {
		x = toFloat32( x*SCALAR );
		return [ x, -23 ];
	}
	return [ x, 0 ];
}
1181772
def _algebraic_rules_scalar():
    """"""
    a = wc("a", head=SCALAR_VAL_TYPES)
    b = wc("b", head=SCALAR_VAL_TYPES)
    x = wc("x", head=SCALAR_TYPES)
    y = wc("y", head=SCALAR_TYPES)
    z = wc("z", head=SCALAR_TYPES)

    indranges__ = wc("indranges__", head=IndexRangeBase)

    ScalarTimes._binary_rules.update(check_rules_dict([
        ('R001', (
            pattern_head(a, b),
            lambda a, b: a * b)),
        ('R002', (
            pattern_head(x, x),
            lambda x: x**2)),
        ('R003', (
            pattern_head(Zero, x),
            lambda x: Zero)),
        ('R004', (
            pattern_head(x, Zero),
            lambda x: Zero)),
        ('R005', (
            pattern_head(
                pattern(ScalarPower, x, y),
                pattern(ScalarPower, x, z)),
            lambda x, y, z: x**(y+z))),
        ('R006', (
            pattern_head(x, pattern(ScalarPower, x, -1)),
            lambda x: One)),
    ]))

    ScalarPower._rules.update(check_rules_dict([
        ('R001', (
            pattern_head(a, b),
            lambda a, b: a**b)),
        ('R002', (
            pattern_head(x, 0),
            lambda x: One)),
        ('R003', (
            pattern_head(x, 1),
            lambda x: x)),
        ('R004', (
            pattern_head(pattern(ScalarPower, x, y), z),
            lambda x, y, z: x**(y*z))),
    ]))

    def pull_constfactor_from_sum(x, y, indranges):
        bound_symbols = set([r.index_symbol for r in indranges])
        if len(x.free_symbols.intersection(bound_symbols)) == 0:
            return x * ScalarIndexedSum.create(y, *indranges)
        else:
            raise CannotSimplify()

    ScalarIndexedSum._rules.update(check_rules_dict([
        ('R001', (  # sum over zero -> zero
            pattern_head(Zero, indranges__),
            lambda indranges: Zero)),
        ('R002', (  # pull constant prefactor out of sum
            pattern_head(pattern(ScalarTimes, x, y), indranges__),
            lambda x, y, indranges:
                pull_constfactor_from_sum(x, y, indranges))),
    ]))
702946
function scalartyp()
		{
			reset($this->me);
			list($a,)=each($this->me);
			if($a==$GLOBALS['xmlrpcI4'])
			{
				$a=$GLOBALS['xmlrpcInt'];
			}
			return $a;
		}
1228821
def _flatten(cls, arr) -> List[float]:
        
        if isinstance(arr, cls.SCALAR_ACTION_TYPES):
            arr = [float(arr)]
        if isinstance(arr, np.ndarray):
            arr = arr.tolist()
        if len(arr) == 0:
            return arr
        if isinstance(arr[0], np.ndarray):
            arr = [item for sublist in arr for item in sublist.tolist()]
        if isinstance(arr[0], list):
            arr = [item for sublist in arr for item in sublist]
        arr = [float(x) for x in arr]
        return arr
83034
def simplify_scalar(self, func=sympy.simplify):
        
        return SLH(
            self.S.simplify_scalar(func=func),
            self.L.simplify_scalar(func=func),
            self.H.simplify_scalar(func=func))
794344
def beta_array(C, HIGHSCALE, *args, **kwargs):
    """"""
    beta_odict = beta(C, HIGHSCALE, *args, **kwargs)
    return np.hstack([np.asarray(b).ravel() for b in beta_odict.values()])
1332242
def get_scalar(self, name, preference='cell', info=False):
        
        return get_scalar(self, name, preference=preference, info=info)
556254
def convert_to_scalars(cls, ops, kwargs):
    """"""
    from qnet.algebra.core.scalar_algebra import Scalar, ScalarValue
    scalar_ops = []
    for op in ops:
        if not isinstance(op, Scalar):
            scalar_ops.append(ScalarValue(op))
        else:
            scalar_ops.append(op)
    return scalar_ops, kwargs
809120
def scalar_op_helper(node, op_name, **kwargs):
    """"""
    name, input_nodes, attrs = get_inputs(node, kwargs)
    from onnx import numpy_helper
    input_type = kwargs["in_type"]
    scalar_value = np.array([attrs.get("scalar", 1)],
                            dtype=onnx.mapping.TENSOR_TYPE_TO_NP_TYPE[input_type])

    initializer = kwargs["initializer"]
    flag = True
    # If the input value is in initializer, just multiply with scalar input
    # and create a new initializer
    for i in initializer:
        if i.name == input_nodes[0]:
            if op_name == 'Mul':
                new_initializer = numpy_helper.to_array(i) * scalar_value[0]
            elif op_name == 'Sub':
                if name.startswith("_rminusscalar"):
                    new_initializer = scalar_value[0] - numpy_helper.to_array(i)
                else:
                    new_initializer = numpy_helper.to_array(i) - scalar_value[0]
            elif op_name == 'Add':
                new_initializer = numpy_helper.to_array(i) + scalar_value[0]
            elif op_name == 'Div':
                if name.startswith("_rdivscalar"):
                    new_initializer = scalar_value[0] / numpy_helper.to_array(i)
                else:
                    new_initializer = numpy_helper.to_array(i) / scalar_value[0]
            elif op_name == 'Pow':
                new_initializer = numpy_helper.to_array(i) ** scalar_value[0]
            flag = False
            break

    # else create a new tensor of the scalar value, add it in initializer
    if flag is True:
        dims = np.shape(scalar_value)

        scalar_op_name = "scalar_op" + str(kwargs["idx"])
        tensor_node = onnx.helper.make_tensor_value_info(scalar_op_name, input_type, dims)

        initializer.append(
            onnx.helper.make_tensor(
                name=scalar_op_name,
                data_type=input_type,
                dims=dims,
                vals=scalar_value,
                raw=False,
            )
        )

        mul_node = onnx.helper.make_node(
            op_name,
            [input_nodes[0], scalar_op_name],
            [name],
            name=name
        )

        return [tensor_node, mul_node]
    else:
        data_type = onnx.mapping.NP_TYPE_TO_TENSOR_TYPE[new_initializer.dtype]
        dims = np.shape(new_initializer)

        new_a_node = input_nodes[0] + str(kwargs["idx"])
        tensor_node = onnx.helper.make_tensor_value_info(new_a_node, data_type, dims)

        initializer.append(
            onnx.helper.make_tensor(
                name=new_a_node,
                data_type=data_type,
                dims=dims,
                vals=new_initializer,
                raw=False,
            )
        )
        return [tensor_node]