class_docstr: Test both vector operations and MLlib algorithms with SciPy sparse matrices,
  if SciPy is available.
class_docstr_tok: ["Test","both","vector","operations","and","MLlib","algorithms","with","SciPy","sparse","matrices",",","if","SciPy","is","available","."]
code: def test_convert_to_vector(self):
      from scipy.sparse import csc_matrix
  
      # Create a CSC matrix with non-sorted indices
      indptr = array([0, 2])
      indices = array([3, 1])
      data = array([2.0, 1.0])
      csc = csc_matrix((data, indices, indptr))
      self.assertFalse(csc.has_sorted_indices)
      sv = SparseVector(4, {1: 1, 3: 2})
      self.assertEqual(sv, _convert_to_vector(csc))
  
imports: import array
  import unittest
  from numpy import array, array_equal, zeros, arange, tile, ones, inf
  import pyspark.ml.linalg
  from pyspark.serializers import CPickleSerializer
  from pyspark.mllib.linalg import Vector, SparseVector, DenseVector, VectorUDT, _convert_to_vector, DenseMatrix, SparseMatrix, Vectors, Matrices, MatrixUDT
  from pyspark.mllib.linalg.distributed import RowMatrix, IndexedRowMatrix, IndexedRow
  from pyspark.mllib.regression import LabeledPoint
  from pyspark.sql import Row
  from pyspark.testing.mllibutils import MLlibTestCase
  from pyspark.testing.utils import have_scipy
label_desc: Use image node_id 2 for calling the SciPyTests obj's underlying member method code with example usage: obj.test_convert_to_vector() without return types