Lines Matching refs:numRows
717 def __init__ (self, numCols, numRows, scalars):
718 assert len(scalars) == numRows*numCols
720 self.numRows = numRows
724 def fromScalar (numCols, numRows, scalar):
727 for row in range(0, numRows):
729 return Mat(numCols, numRows, scalars)
732 def identity (numCols, numRows):
733 return Mat.fromScalar(numCols, numRows, 1.0)
737 assert 0 <= rowNdx and rowNdx < self.numRows
738 return self.scalars[colNdx*self.numRows + rowNdx]
742 assert 0 <= rowNdx and rowNdx < self.numRows
743 self.scalars[colNdx*self.numRows + rowNdx] = scalar
745 def toMatrix (self, numCols, numRows):
746 res = Mat.identity(numCols, numRows)
748 for row in range(0, min(self.numRows, numRows)):
763 if self.numRows == self.numCols:
764 return "mat%d" % self.numRows
766 return "mat%dx%d" % (self.numCols, self.numRows)
772 return isinstance(other, Mat) and self.numRows == other.numRows and self.numCols == other.numCols
780 return Mat(self.numRows, self.numCols, [self.scalars(i) * val.scalars(i) for i in range(self.numRows*self.numCols)])