code: def _train_matrix_cd(
      mat: CSR, this: np.ndarray, other: np.ndarray, reg: float
  ):
      """
      One half of an explicit ALS training round using coordinate descent.
  
      Args:
          mat: the :math:`m \\times n` matrix of ratings
          this: the :math:`m \\times k` matrix to train
          other: the :math:`n \\times k` matrix of sample features
          reg: the regularization term
      """
      nr = mat.nrows
      nf = other.shape[1]
      assert mat.ncols == other.shape[0]
      assert mat.nrows == this.shape[0]
      assert this.shape[1] == nf
  
      frob = 0.0
  
      for i in prange(nr):
          cols = mat.row_cs(i)
          if len(cols) == 0:
              continue
  
          vals = mat.row_vs(i)
  
          w = this[i, :].copy()
          _rr_solve(other, cols, vals, w, reg * len(cols), 2)
          delta = this[i, :] - w
          frob += np.dot(delta, delta)
          this[i, :] = w
  
      return np.sqrt(frob)
  
imports: import logging
  from collections import namedtuple
  import numpy
  from numba import njit, prange
  from csr import CSR
  from seedbank import numpy_rng
  from .bias import Bias
  from .mf_common import MFPredictor
  from ..data import sparse_ratings
  from ..None import util
  from ..math.solve import _dposv
label_desc: Use image node_id 3 for calling a global function with example usage: _train_matrix_cd(mat, this, other, reg) and returns: np