ams.core.service.VarReduction#

class ams.core.service.VarReduction(u: Callable, fun: Callable, name: str = None, tex_name: str = None, unit: str = None, info: str = None, vtype: Type = None, rfun: Callable = None, rargs: dict = None, no_parse: bool = False, sparse: bool = False, **kwargs)[source]#

A numerical matrix to reduce a 2D variable to 1D, np.fun(shape=(1, u.n)).

Parameters:
uCallable

The input matrix variable.

funCallable

The reduction function that takes a shape parameter (1D shape) as input.

namestr, optional

The name of the instance.

tex_namestr, optional

The TeX name for the instance.

unitstr, optional

The unit of the output.

infostr, optional

A description of the operation.

vtypeType, optional

The variable type.

modelstr, optional

The model name associated with the operation.

sparse: bool, optional

True to return output as scipy csr_matrix.

__init__(u: Callable, fun: Callable, name: str = None, tex_name: str = None, unit: str = None, info: str = None, vtype: Type = None, rfun: Callable = None, rargs: dict = None, no_parse: bool = False, sparse: bool = False, **kwargs)[source]#

Methods

assign_memory(n)

Assign memory for self.v and set the array to zero.

get_names()

Return name in a list

parse()

Parse the parameter.

update()

Update the Parameter value.

Attributes

class_name

Return the class name

n

Return the count of values in self.v.

shape

Return the shape of the service.

size

Return the size.

v

Value of the service.

v0

v1