Skip to content

Commit 72803af

Browse files
authored
Merge pull request #33 from sandialabs/30-implement-gs-orthogonalization
minor edits from Habib
2 parents 1185700 + 607ecdc commit 72803af

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/pytuq/ftools/gso.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self,x,L=None,verbose=False):
3939
L (np.ndarray or callable or None) : 2d float array of shape :math:`(M,npt)` or a callable user-provided function or None.
4040
verbose (bool) : controls verbosity
4141
'''
42-
self.x = np.asarray(x,copy=True)
42+
self.x = np.array(x)
4343
if verbose:
4444
print(f'x: {self.x.shape}')
4545

@@ -51,7 +51,7 @@ def __init__(self,x,L=None,verbose=False):
5151
if verbose:
5252
print(f'L: function:',self.L)
5353
else:
54-
self.L = np.asarray(L,copy=True)
54+
self.L = np.array(L)
5555
assert (self.L.shape[1] == self.npt), 'with L as array, it must have shape (:,npt)'
5656
if verbose:
5757
print(f'L: matrix: {self.L.shape}')
@@ -428,7 +428,6 @@ def ortho(self,modified=False,verbose=False,stage=0):
428428
self.Z[i,i] = 1.0
429429

430430
if i > 0:
431-
#rgam = np.array([self.iprod(self.phi[i],self.tht[j]) for j in range(i)])
432431
rgam = self.iprod(self.phi,self.tht,k=i,l=0,kmxp=i+1,lmxp=i)[0]
433432
if np.all(self.lam[0:i]):
434433
self.Z[i,0:i] = np.multiply(rgam,self.lam[0:i])
@@ -581,16 +580,16 @@ def ortho(self,modified=False,nstage=1,verbose=False):
581580

582581
if False:
583582
with open('gso_P'+str(stage)+'.txt', 'w') as f:
584-
f.write('pymgs gso P'+str(stage)+':\n')
583+
f.write('gso P'+str(stage)+':\n')
585584
np.savetxt(f, self.mgs[stage].Pmat, fmt='%.18e', delimiter=' ')
586585
xt = np.linspace(0,1,100)
587586
phixt = np.array([f(xt) for f in self.mgs[stage].phi]).T
588587
thtxt = np.array([f(xt) for f in self.mgs[stage].tht]).T
589588
with open('gso_phi'+str(stage)+'.txt', 'w') as f:
590-
f.write('pymgs gso phixt'+str(stage)+':\n')
589+
f.write('gso phixt'+str(stage)+':\n')
591590
np.savetxt(f, phixt, fmt='%.18e', delimiter=' ')
592591
with open('gso_tht'+str(stage)+'.txt', 'w') as f:
593-
f.write('pymgs gso thtxt'+str(stage)+':\n')
592+
f.write('gso thtxt'+str(stage)+':\n')
594593
np.savetxt(f, thtxt, fmt='%.18e', delimiter=' ')
595594

596595
self.thta[stage] = copy.deepcopy(self.mgs[stage].tht)

0 commit comments

Comments
 (0)