Returns the permutation matrix.
343644
public PermutationMatrix getP() {
        PermutationMatrix perm = PermutationMatrix.fromPartialPivots(piv);
        perm.transpose();
        return perm;
    }
452307
@Nonnull
  @ReturnsMutableCopy
  public Matrix getD ()
  {
    final Matrix aNewMatrix = new Matrix (m_nDim, m_nDim);
    final double [] [] aNewArray = aNewMatrix.internalGetArray ();
    for (int nRow = 0; nRow < m_nDim; nRow++)
    {
      final double [] aDstRow = aNewArray[nRow];
      Arrays.fill (aDstRow, 0.0);
      aDstRow[nRow] = m_aEVd[nRow];

      final double dEVe = m_aEVe[nRow];
      if (dEVe > 0)
        aDstRow[nRow + 1] = dEVe;
      else
        if (dEVe < 0)
          aDstRow[nRow - 1] = dEVe;
    }
    return aNewMatrix;
  }
1197690
public function getMatrix()
    {
        if (func_num_args() > 0) {
            $args = func_get_args();
            $match = implode(',', array_map('gettype', $args));
            switch ($match) {
 
      //A($i0...; $j0...)
      case 'integer,integer':
        list($i0, $j0) = $args;
          $m = $i0 >= 0 ? $this->m - $i0 : trigger_error(ArgumentBoundsException, ERROR);
          $n = $j0 >= 0 ? $this->n - $j0 : trigger_error(ArgumentBoundsException, ERROR);
          $R = new Matrix($m, $n);
 
          for ($i = $i0; $i < $this->m; $i++) {
              for ($j = $j0; $j < $this->n; $j++) {
                  $R->set($i, $j, $this->A[$i][$j]);
              }
          }
 
          return $R;
          break;
 
      //A($i0...$iF; $j0...$jF)
      case 'integer,integer,integer,integer':
       list($i0, $iF, $j0, $jF) = $args;
        $m = (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) ? $iF - $i0 : trigger_error(ArgumentBoundsException, ERROR);
        $n = (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) ? $jF - $j0 : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m+1, $n+1);
 
        for ($i = $i0; $i <= $iF; $i++) {
            for ($j = $j0; $j <= $jF; $j++) {
                $R->set($i - $i0, $j - $j0, $this->A[$i][$j]);
            }
        }
 
        return $R;
        break;
 
      //$R = array of row indices; $C = array of column indices
      case 'array,array':
        list($RL, $CL) = $args;
        $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR);
        $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m, $n);
 
        for ($i = 0; $i < $m; $i++) {
            for ($j = 0; $j < $n; $j++) {
                $R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]);
            }
        }
 
        return $R;
        break;
 
      //$RL = array of row indices; $CL = array of column indices
      case 'array,array':
        list($RL, $CL) = $args;
        $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR);
        $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m, $n);
 
        for ($i = 0; $i < $m; $i++) {
            for ($j = 0; $j < $n; $j++) {
                $R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]);
            }
        }
 
        return $R;
        break;
 
      //A($i0...$iF); $CL = array of column indices
      case 'integer,integer,array':
        list($i0, $iF, $CL) = $args;
        $m = (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) ? $iF - $i0 : trigger_error(ArgumentBoundsException, ERROR);
        $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m, $n);
 
        for ($i = $i0; $i < $iF; $i++) {
            for ($j = 0; $j < $n; $j++) {
                $R->set($i - $i0, $j, $this->A[$RL[$i]][$j]);
            }
        }
 
        return $R;
        break;
 
      //$RL = array of row indices
      case 'array,integer,integer':
        list($RL, $j0, $jF) = $args;
        $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR);
        $n = (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) ? $jF - $j0 : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m, $n+1);
 
        for ($i = 0; $i < $m; $i++) {
            for ($j = $j0; $j <= $jF; $j++) {
                $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
            }
        }
 
        return $R;
        break;
      default:
        trigger_error(PolymorphicArgumentException, ERROR);
        break;
      }
        } else {
            trigger_error(PolymorphicArgumentException, ERROR);
        }
    }
164831
public BigInteger[][] getMatrix()
    {
        BigInteger[][] ret = new BigInteger[rows.size()][rows.get(0).size()];

        final int height = ret.length;
        final int width = ret[0].length;
        for (int i = 0; i < height; i++)
        {
            for (int j = 0; j < width; j++)
            {
                ret[i][j] = rows.get(i).getColumn(j);
            }
        }

        return ret;
    }
1295896
function() {
        return this.set(
			this.matrix[0][0], this.matrix[1][0], this.matrix[2][0], this.matrix[3][0],
			this.matrix[0][1], this.matrix[1][1], this.matrix[2][1], this.matrix[3][1],
			this.matrix[0][2], this.matrix[1][2], this.matrix[2][2], this.matrix[3][2],
			this.matrix[0][3], this.matrix[1][3], this.matrix[2][3], this.matrix[3][3]
		);
	}
128713
public Matrix4f getMatrix() {
        if (updateMatrix) {
            final Matrix4f matrix = Matrix4f.createScaling(scale.toVector4(1)).rotate(rotation).translate(position);
            if (parent == null) {
                this.matrix = matrix;
            } else {
                childMatrix = matrix;
            }
            updateMatrix = false;
        }
        if (parent != null) {
            final Matrix4f parentMatrix = parent.getMatrix();
            if (parentMatrix != lastParentMatrix) {
                matrix = parentMatrix.mul(childMatrix);
                lastParentMatrix = parentMatrix;
            }
        }
        return matrix;
    }
610606
def T(self):
        """"""
        mycrs = matrix.to_list(self)
        trans_crs = []
        for cr in mycrs:
            trans_crs.append(_np.transpose(cr, [0, 2, 1, 3]))
        return matrix.from_list(trans_crs)
862231
private List<Integer> getPermutation() {
		List<Integer> permutation = new ArrayList<Integer>(transformedCoords.length);
		double sum = 0.0f;

		for (Point3d t: transformedCoords) {
			List<Integer> neighbors = box.getNeighborsWithCache(t);
			int closest = -1;
			double minDist = Double.MAX_VALUE;

			 for (int j : neighbors) {
				double dist = t.distanceSquared(originalCoords[j]);
				if (dist < minDist) {
					closest = j;
					minDist = dist;
				}
			}

			sum += minDist;
			if (closest == -1) {
				 break;
			}
			permutation.add(closest);
		}
		double rmsd = Math.sqrt(sum / transformedCoords.length);

		if (rmsd > distanceThreshold || permutation.size() != transformedCoords.length) {
			permutation.clear();
			return permutation;
		}

		// check uniqueness of indices
		Set<Integer> set = new HashSet<Integer>(permutation);

		// if size mismatch, clear permutation (its invalid)
		if (set.size() != originalCoords.length) {
			permutation.clear();
		}

		return permutation;
	}
231068
public static DMatrixSparseCSC permutationMatrix(int[] p, boolean inverse, int N, DMatrixSparseCSC P) {

        if( P == null )
            P = new DMatrixSparseCSC(N,N,N);
        else
            P.reshape(N,N,N);
        P.indicesSorted = true;
        P.nz_length = N;

        // each column should have one element inside of it
        if( !inverse ) {
            for (int i = 0; i < N; i++) {
                P.col_idx[i + 1] = i + 1;
                P.nz_rows[p[i]] = i;
                P.nz_values[i] = 1;
            }
        } else {
            for (int i = 0; i < N; i++) {
                P.col_idx[i + 1] = i + 1;
                P.nz_rows[i] = p[i];
                P.nz_values[i] = 1;
            }
        }

        return P;
    }
1086064
public Matrix4f getViewMatrix() {
        if (updateViewMatrix) {
            rotationMatrixInverse = Matrix4f.createRotation(rotation);
            final Matrix4f rotationMatrix = Matrix4f.createRotation(rotation.invert());
            final Matrix4f positionMatrix = Matrix4f.createTranslation(position.negate());
            viewMatrix = rotationMatrix.mul(positionMatrix);
            updateViewMatrix = false;
        }
        return viewMatrix;
    }
241017
public Matrix transpose() {
        Matrix result = blankOfShape(columns, rows);
        MatrixIterator it = result.iterator();

        while (it.hasNext()) {
            it.next();
            int i = it.rowIndex();
            int j = it.columnIndex();
            it.set(get(j, i));
        }

        return result;
    }
569420
function() {
            var m = this.m,
                a = m.a,
                b = m.b,
                c = m.c,
                d = m.d,
                e = m.e,
                f = m.f,
                k, aa, bb, cc, dd, ee, ff;
            k = a * d - b * c;
            aa = d / k;
            bb = -b / k;
            cc = -c / k;
            dd = a / k;
            ee = (c * f - e * d) / k;
            ff = (b * e - a * f) / k;
            return new Matrix(aa, bb, cc, dd, ee, ff);
        }
883931
def get_matrix(self):
        
        # Init matrix (remember, a matrix, not an array)
        a = np.zeros((4, 4), dtype=np.float32)
        w, x, y, z = self.w, self.x, self.y, self.z
        # First row
        a[0, 0] = - 2.0 * (y * y + z * z) + 1.0
        a[1, 0] = + 2.0 * (x * y + z * w)
        a[2, 0] = + 2.0 * (x * z - y * w)
        a[3, 0] = 0.0
        # Second row
        a[0, 1] = + 2.0 * (x * y - z * w)
        a[1, 1] = - 2.0 * (x * x + z * z) + 1.0
        a[2, 1] = + 2.0 * (z * y + x * w)
        a[3, 1] = 0.0
        # Third row
        a[0, 2] = + 2.0 * (x * z + y * w)
        a[1, 2] = + 2.0 * (y * z - x * w)
        a[2, 2] = - 2.0 * (x * x + y * y) + 1.0
        a[3, 2] = 0.0
        # Fourth row
        a[0, 3] = 0.0
        a[1, 3] = 0.0
        a[2, 3] = 0.0
        a[3, 3] = 1.0
        return a
778870
function() {
    var rows = this.elements.length, cols = this.elements[0].length;
    var elements = [], ni = cols, i, nj, j;
    do { i = cols - ni;
      elements[i] = [];
      nj = rows;
      do { j = rows - nj;
        elements[i][j] = this.elements[j][i];
      } while (--nj);
    } while (--ni);
    return Matrix.create(elements);
  }
1337119
def get_matrix(self):
        
        return np.array([ self.get_row_list(i) for i in range(self.row_count()) ])
913905
def matrix(self):
        """"""
        result = np.identity(4, float)
        result[0:3, 0:3] = self.r
        return result
658174
def _generate_permutation(self, npoints):
        
        i = np.arange(0, npoints)
        # permutation
        p = np.random.permutation(npoints)
        ip = np.empty_like(p)
        # inverse permutation
        ip[p[i]] = i
        return p, ip