def cos_r(self, N=None):  # percent=0.9
		"""Return the squared cosines for each row."""

		if not hasattr(self, 'F') or self.F.shape[1] < self.rank:
			self.fs_r(N=self.rank)  # generate F
		self.dr = norm(self.F, axis=1)**2
		# cheaper than diag(self.F.dot(self.F.T))?

		return apply_along_axis(lambda _: _/self.dr, 0, self.F[:, :N]**2)
def cos_r ( self , N = None ) : if not hasattr ( self , 'F' ) or self . F . shape [ 1 ] < self . rank : self . fs_r ( N = self . rank ) self . dr = norm ( self . F , axis = 1 ) ** 2 return apply_along_axis ( lambda _ : _ / self . dr , 0 , self . F [ : , : N ] ** 2 )
Return the squared cosines for each row.