class_docstr: Replaces any 2-dimensional numpy array of doubles with a literal DenseMatrix.
  
  Added in version 0.4.0.
  
  Examples:
      >>> import numpy as np
      >>> from pyspark.sql.functions import lit
      >>> from pyspark.sql.types import StringType
      >>> str_list = ['a', 'b']
      >>> df = spark.createDataFrame(str_list, StringType())
      >>> ndarray = np.array([[1.0, 2.1, 3.2], [4.3, 5.4, 6.5]])
      >>> df.withColumn("matrix", lit(ndarray)).collect()
      [Row(value='a', matrix=DenseMatrix(2, 3, [1.0, 4.3, 2.1, 5.4, 3.2, 6.5], False)), Row(value='b', matrix=DenseMatrix(2, 3, [1.0, 4.3, 2.1, 5.4, 3.2, 6.5], False))]
class_docstr_tok: ["Replaces","any","2-dimensional","numpy","array","of","doubles","with","a","literal","DenseMatrix",".","Added","in","version","0.4.0",".","Examples",":",">",">",">","import","numpy","as","np",">",">",">","from","pyspark.sql.functions","import","lit",">",">",">","from","pyspark.sql.types","import","StringType",">",">",">","str_list","=","[","'","a","'",",","'","b","'","]",">",">",">","df","=","spark.createDataFrame","(","str_list",",","StringType","(",")",")",">",">",">","ndarray","=","np.array","(","[","[","1.0",",","2.1",",","3.2","]",",","[","4.3",",","5.4",",","6.5","]","]",")",">",">",">","df.withColumn","(","``","matrix","''",",","lit","(","ndarray",")",")",".collect","(",")","[","Row","(","value=","'","a","'",",","matrix=DenseMatrix","(","2",",","3",",","[","1.0",",","4.3",",","2.1",",","5.4",",","3.2",",","6.5","]",",","False",")",")",",","Row","(","value=","'","b","'",",","matrix=DenseMatrix","(","2",",","3",",","[","1.0",",","4.3",",","2.1",",","5.4",",","3.2",",","6.5","]",",","False",")",")","]"]
code: def convert(self, object, gateway_client):
      sc = SparkContext._active_spark_context
      flat_arr = object.ravel(order="F")
      java_arr = _convert_numpy_to_java_array(flat_arr)
      dense_matrix = sc._jvm.org.apache.spark.ml.linalg.DenseMatrix(
          object.shape[0], object.shape[1], java_arr
      )
      matrix_udt = sc._jvm.org.apache.spark.ml.linalg.MatrixUDT()
      converter = sc._jvm.org.apache.spark.sql.catalyst.CatalystTypeConverters.createToCatalystConverter(
          matrix_udt
      )
      literal_matrix = sc._jvm.org.apache.spark.sql.catalyst.expressions.Literal.create(
          converter.apply(dense_matrix), matrix_udt
      )
      return literal_matrix
  
file_path: glow/python/glow/conversions.py
imports: import numpy
  from py4j.java_collections import JavaArray
  from pyspark import SparkContext
  from typeguard import check_argument_types, check_return_type
label_desc: Use image node_id 2 for calling the TwoDimensionalDoubleNumpyArrayConverter obj's underlying member method code with example usage: obj.convert(object, gateway_client) and returns: literal_matrix