Matrix¶
A Matrix
is represented either by an OperationNode
, or the derived class Matrix
.
An Matrix can be recognized it by checking the output_type
of the object.
Matrices are the most fundamental objects SystemDS operates on.
Although it is possible to generate matrices with the function calls or object construction specified below,
the recommended way is to use the methods defined on SystemDSContext
.
-
class
systemds.matrix.
Matrix
(sds_context: SystemDSContext, mat: numpy.array, *args: Sequence[Union[DAGNode, str, int, float, bool]], **kwargs: Dict[str, Union[DAGNode, str, int, float, bool]])¶ -
__init__
(sds_context: SystemDSContext, mat: numpy.array, *args: Sequence[Union[DAGNode, str, int, float, bool]], **kwargs: Dict[str, Union[DAGNode, str, int, float, bool]]) → None¶ Generate DAGNode representing matrix with data given by a numpy array, which will be sent to SystemDS on need.
- Parameters
mat – the numpy array
args – unnamed parameters
kwargs – named parameters
-
code_line
(var_name: str, unnamed_input_vars: Sequence[str], named_input_vars: Dict[str, str]) → str¶ Generates the DML code line equal to the intended action of this node.
- Parameters
var_name – Name of DML-variable this nodes result should be saved in
unnamed_input_vars – all strings representing the unnamed parameters
named_input_vars – all strings representing the named parameters (name value pairs)
- Returns
the DML code line that is equal to this operation
-
compute
(verbose: bool = False, lineage: bool = False) → numpy.array¶ Get result of this operation. Builds the dml script and executes it in SystemDS, before this method is called all operations are only building the DAG without actually executing (lazy evaluation).
- Parameters
verbose – Can be activated to print additional information such as created DML-Script
lineage – Can be activated to print lineage trace till this node
- Returns
the output as an python builtin data type or numpy array
-
pass_python_data_to_prepared_script
(sds, var_name: str, prepared_script: py4j.java_gateway.JavaObject) → None¶ Passes data from python to the prepared script object.
- Parameters
jvm – the java virtual machine object
var_name – the variable name the data should get in java
prepared_script – the prepared script
-