You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/base/ctrsv/lib/base.js
+65-74Lines changed: 65 additions & 74 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ var f32 = require( '@stdlib/number/float64/base/to-float32' );
28
28
// MAIN //
29
29
30
30
/**
31
-
* Solves one of the systems of equations `A*x = b` or `A^T*x = b` or `A^H*x = b` where `b` and `x` are `N` element complex vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular complex matrix.
31
+
* Solves one of the systems of equations `A*x = b` or `A^T*x = b` or `A^H*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
32
32
*
33
33
* @private
34
34
* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix
@@ -82,61 +82,52 @@ function ctrsv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
82
82
vari1;
83
83
varia;
84
84
85
-
// Layout
86
-
isrm=isRowMajor([strideA1,strideA2]);
85
+
// Note on variable naming convention: sa#, ix#, i# where # corresponds to the loop number, with `0` being the innermost loop...
87
86
88
-
// Diagonal
87
+
isrm=isRowMajor([strideA1,strideA2]);
89
88
nonunit=(diag==='non-unit');
90
89
91
-
// Reinterpret arrays to raw numeric views
90
+
if(isrm){
91
+
// For row-major matrices, the last dimension has the fastest changing index...
92
+
sa0=strideA2*2;// stride increment for innermost loop
93
+
sa1=strideA1*2;// stride increment for outermost loop
94
+
}else{// isColMajor
95
+
// For column-major matrices, the first dimension has the fastest changing index...
96
+
sa0=strideA1*2;// stride increment for innermost loop
97
+
sa1=strideA2*2;// stride increment for outermost loop
98
+
}
99
+
// Reinterpret arrays to real-valued views
92
100
viewA=reinterpret(A,0);
93
101
viewX=reinterpret(x,0);
94
-
95
-
// Set sign to handle conjugation: flip the imaginary part for conjugate-transpose
96
102
if(trans==='conjugate-transpose'){
97
103
sign=-1;
98
104
}else{
99
105
sign=1;
100
106
}
101
-
102
-
if(isrm){
103
-
// For row-major matrices, the last dimension has the fastest changing index...
104
-
sa0=strideA2*2;// offset increment for innermost loop
105
-
sa1=strideA1*2;// offset increment for outermost loop
106
-
}else{// isColMajor
107
-
// For column-major matrices, the first dimension has the fastest changing index...
108
-
sa0=strideA1*2;// offset increment for innermost loop
109
-
sa1=strideA2*2;// offset increment for outermost loop
110
-
}
111
-
112
-
// Vector indexing base
113
107
oa=offsetA*2;
114
108
ox=offsetX*2;
115
-
116
-
// Vector strides
117
109
sx=strideX*2;
118
-
119
110
doa2=sa1+sa0;
120
111
121
112
if(
122
113
(!isrm&&uplo==='upper'&&trans==='no-transpose')||
123
114
(isrm&&uplo==='lower'&&trans!=='no-transpose')
124
115
){
125
-
ix1=ox+((N-1)*sx);
126
-
oa2=oa+(doa2*(N-1));
116
+
ix1=ox+((N-1)*sx);
117
+
oa2=oa+(doa2*(N-1));
127
118
for(i1=N-1;i1>=0;i1--){
128
119
rex=viewX[ix1];
129
-
imx=viewX[ix1+1];
120
+
imx=viewX[ix1+1];
130
121
if(rex!==0.0||imx!==0.0){
131
122
if(nonunit){
132
123
ia=oa2;
133
124
rea=viewA[ia];
134
-
ima=sign*viewA[ia+1];
135
-
magsq=f32((rea*rea)+(ima*ima));
136
-
retmp=f32(f32((rex*rea)+(imx*ima))/magsq);
137
-
imtmp=f32(f32((imx*rea)-(rex*ima))/magsq);
125
+
ima=sign*viewA[ia+1];
126
+
magsq=f32(f32(rea*rea)+f32(ima*ima));
127
+
retmp=f32((f32(rex*rea)+f32(imx*ima))/magsq);
128
+
imtmp=f32((f32(imx*rea)-f32(rex*ima))/magsq);
138
129
viewX[ix1]=retmp;
139
-
viewX[ix1+1]=imtmp;
130
+
viewX[ix1+1]=imtmp;
140
131
}else{
141
132
retmp=rex;
142
133
imtmp=imx;
@@ -145,13 +136,13 @@ function ctrsv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
145
136
ix0=ix1-sx;
146
137
for(i0=i1-1;i0>=0;i0--){
147
138
rea=viewA[ia];
148
-
ima=sign*viewA[ia+1];
139
+
ima=sign*viewA[ia+1];
149
140
rex=viewX[ix0];
150
-
imx=viewX[ix0+1];
151
-
remul=f32((retmp*rea)-(imtmp*ima));
152
-
immul=f32((retmp*ima)+(imtmp*rea));
153
-
viewX[ix0]=f32(rex-remul);
154
-
viewX[ix0+1]=f32(imx-immul);
141
+
imx=viewX[ix0+1];
142
+
remul=f32(f32(retmp*rea)-f32(imtmp*ima));
143
+
immul=f32(f32(retmp*ima)+f32(imtmp*rea));
144
+
viewX[ix0]=f32(rex-remul);
145
+
viewX[ix0+1]=f32(imx-immul);
155
146
ix0-=sx;
156
147
ia-=sa0;
157
148
}
@@ -169,17 +160,17 @@ function ctrsv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
169
160
oa2=oa;
170
161
for(i1=0;i1<N;i1++){
171
162
rex=viewX[ix1];
172
-
imx=viewX[ix1+1];
163
+
imx=viewX[ix1+1];
173
164
if(rex!==0.0||imx!==0.0){
174
165
if(nonunit){
175
166
ia=oa2;
176
167
rea=viewA[ia];
177
-
ima=sign*viewA[ia+1];
178
-
magsq=f32((rea*rea)+(ima*ima));
179
-
retmp=f32(f32((rex*rea)+(imx*ima))/magsq);
180
-
imtmp=f32(f32((imx*rea)-(rex*ima))/magsq);
168
+
ima=sign*viewA[ia+1];
169
+
magsq=f32(f32(rea*rea)+f32(ima*ima));
170
+
retmp=f32(f32(f32(rex*rea)+f32(imx*ima))/magsq);
171
+
imtmp=f32(f32(f32(imx*rea)-f32(rex*ima))/magsq);
181
172
viewX[ix1]=retmp;
182
-
viewX[ix1+1]=imtmp;
173
+
viewX[ix1+1]=imtmp;
183
174
}else{
184
175
retmp=rex;
185
176
imtmp=imx;
@@ -188,13 +179,13 @@ function ctrsv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
188
179
ix0=ix1+sx;
189
180
for(i0=i1+1;i0<N;i0++){
190
181
rea=viewA[ia];
191
-
ima=sign*viewA[ia+1];
182
+
ima=sign*viewA[ia+1];
192
183
rex=viewX[ix0];
193
-
imx=viewX[ix0+1];
194
-
remul=f32((retmp*rea)-(imtmp*ima));
195
-
immul=f32((retmp*ima)+(imtmp*rea));
196
-
viewX[ix0]=f32(rex-remul);
197
-
viewX[ix0+1]=f32(imx-immul);
184
+
imx=viewX[ix0+1];
185
+
remul=f32(f32(retmp*rea)-f32(imtmp*ima));
186
+
immul=f32(f32(retmp*ima)+f32(imtmp*rea));
187
+
viewX[ix0]=f32(rex-remul);
188
+
viewX[ix0+1]=f32(imx-immul);
198
189
ia+=sa0;
199
190
ix0+=sx;
200
191
}
@@ -212,69 +203,69 @@ function ctrsv( uplo, trans, diag, N, A, strideA1, strideA2, offsetA, x, strideX
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/base/ctrsv/lib/ctrsv.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ var base = require( './base.js' );
33
33
// MAIN //
34
34
35
35
/**
36
-
* Solves one of the systems of equations `A*x = b` or `A^T*x = b` or `A^H*x = b` where `b` and `x` are `N` element complex vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular complex matrix.
36
+
* Solves one of the systems of equations `A*x = b` or `A^T*x = b` or `A^H*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
37
37
*
38
38
* @param {string} order - storage layout
39
39
* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/base/ctrsv/lib/index.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@
19
19
'use strict';
20
20
21
21
/**
22
-
* BLAS level 2 routine to solve one of the systems of equations `A*x = b` or `A^T*x = b` or `A^H*x = b` where `b` and `x` are `N` element complex vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular complex matrix.
22
+
* BLAS level 2 routine to solve one of the systems of equations `A*x = b` or `A^T*x = b` or `A^H*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/base/ctrsv/lib/ndarray.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ var base = require( './base.js' );
30
30
// MAIN //
31
31
32
32
/**
33
-
* Solves one of the systems of equations `A*x = b` or `A^T*x = b` or `A^H*x = b` where `b` and `x` are `N` element complex vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular complex matrix.
33
+
* Solves one of the systems of equations `A*x = b` or `A^T*x = b` or `A^H*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix.
34
34
*
35
35
* @param {string} uplo - specifies whether `A` is an upper or lower triangular matrix
36
36
* @param {string} trans - specifies whether `A` should be transposed, conjugate-transposed, or not transposed
0 commit comments