Skip to content

Commit 149d3b4

Browse files
author
Denis Jelovina
committed
review
1 parent 4b281d2 commit 149d3b4

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

include/alp/algorithms/cholesky.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ namespace alp {
165165
// Finally collect output into U matrix and return
166166
for( size_t k = 0; k < n; ++k ) {
167167

168-
// U[ k: , k ] = UU[ k: , k ]
168+
// U[ k, k: ] = UU[ k, k: ]
169169
auto vU = get_view( U, k, utils::range( k, n ) );
170170
auto vUU = get_view( UU, k, utils::range( k, n ) );
171171

@@ -361,7 +361,7 @@ namespace alp {
361361
#ifdef DEBUG
362362
print_vector( " -- v -- " , v );
363363
#endif
364-
// UU[ k + 1: , k ] = UU[ k + 1: , k ] / alpha
364+
// UU[ k, k + 1: ] = UU[ k, k + 1: ] / alpha
365365
rc = rc ? rc : foldl( v, alpha, divide );
366366

367367
#ifdef DEBUG

tests/smoke/alp_cholesky.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -151,39 +151,39 @@ alp::RC check_cholesky_solution(
151151
const Scalar< T > zero( ring.template getZero< T >() );
152152
const Scalar< T > one( ring.template getOne< T >() );
153153
const size_t N = nrows( H );
154-
MatSymmType UUT( N );
155-
rc = rc ? rc : alp::set( UUT, zero );
154+
MatSymmType UTU( N );
155+
rc = rc ? rc : alp::set( UTU, zero );
156156
auto UT = alp::get_view< alp::view::transpose >( U );
157157
#ifdef DEBUG
158-
print_matrix( " UUT ", UUT );
158+
print_matrix( " UTU ", UTU );
159159
print_matrix( " U ", U );
160160
print_matrix( " UT ", UT );
161161
#endif
162162
auto UTstar = alp::conjugate( UT );
163-
rc = rc ? rc : alp::mxm( UUT, UTstar, U, ring );
163+
rc = rc ? rc : alp::mxm( UTU, UTstar, U, ring );
164164
#ifdef DEBUG
165-
print_matrix( " << UUT >> ", UUT );
165+
print_matrix( " << UTU >> ", UTU );
166166
#endif
167167

168168
MatSymmType HminsUUt( N );
169169
rc = rc ? rc : alp::set( HminsUUt, zero );
170170

171-
// UUT = -UUT
171+
// UTU = -UTU
172172
Scalar< T > alpha( zero );
173173
rc = rc ? rc : foldl( alpha, one, minus );
174-
rc = rc ? rc : foldl( UUT, alpha, ring.getMultiplicativeOperator() );
174+
rc = rc ? rc : foldl( UTU, alpha, ring.getMultiplicativeOperator() );
175175

176176
#ifdef DEBUG
177-
print_matrix( " -UUT ", UUT );
177+
print_matrix( " -UTU ", UTU );
178178
#endif
179179

180-
// HminsUUt = H - UUT
180+
// HminsUUt = H - UTU
181181
rc = rc ? rc : alp::eWiseApply(
182-
HminsUUt, H, UUT,
182+
HminsUUt, H, UTU,
183183
ring.getAdditiveMonoid()
184184
);
185185
#ifdef DEBUG
186-
print_matrix( " << H - UUT >> ", HminsUUt );
186+
print_matrix( " << H - UTU >> ", HminsUUt );
187187
#endif
188188

189189
//Frobenius norm
@@ -288,37 +288,37 @@ void alp_program( const inpdata &unit, alp::RC &rc ) {
288288
}
289289

290290
// test non-blocked inplace version
291-
alp::Matrix< ScalarType, structures::Square, Dense > UU_original( N );
292-
alp::Matrix< ScalarType, structures::Square, Dense > UU( N );
291+
alp::Matrix< ScalarType, structures::Square, Dense > Uip_original( N );
292+
alp::Matrix< ScalarType, structures::Square, Dense > Uip( N );
293293
std::srand( RNDSEED );
294294
{
295295
std::vector< ScalarType > matrix_data( N * N );
296296
generate_symmherm_pos_def_mat_data_full< ScalarType >( N, matrix_data );
297-
rc = rc ? rc : alp::buildMatrix( UU, matrix_data.begin(), matrix_data.end() );
297+
rc = rc ? rc : alp::buildMatrix( Uip, matrix_data.begin(), matrix_data.end() );
298298
}
299-
rc = rc ? rc : alp::set( UU_original, UU );
299+
rc = rc ? rc : alp::set( Uip_original, Uip );
300300
#ifdef DEBUG
301-
print_matrix( " UU(input) ", UU );
301+
print_matrix( " Uip(input) ", Uip );
302302
#endif
303-
rc = rc ? rc : algorithms::cholesky_uptr( UU, ring );
303+
rc = rc ? rc : algorithms::cholesky_uptr( Uip, ring );
304304
#ifdef DEBUG
305-
print_matrix( " UU(output) ", UU );
305+
print_matrix( " Uip(output) ", Uip );
306306
#endif
307-
auto UUUT = get_view< structures::UpperTriangular >( UU );
308-
rc = rc ? rc : check_cholesky_solution( UU_original, UUUT, ring );
307+
auto UipUpTr = get_view< structures::UpperTriangular >( Uip );
308+
rc = rc ? rc : check_cholesky_solution( Uip_original, UipUpTr, ring );
309309

310310
// test non-blocked inplace version, bs = 1, 2, 4, 8 ... N
311311
for( size_t bs = 1; bs <= N; bs = std::min( bs * 2, N ) ) {
312-
rc = rc ? rc : alp::set( UU, UU_original );
313-
rc = rc ? rc : algorithms::cholesky_uptr_blk( UU, bs, ring );
314-
rc = rc ? rc : check_cholesky_solution( UU_original, UUUT, ring );
312+
rc = rc ? rc : alp::set( Uip, Uip_original );
313+
rc = rc ? rc : algorithms::cholesky_uptr_blk( Uip, bs, ring );
314+
rc = rc ? rc : check_cholesky_solution( Uip_original, UipUpTr, ring );
315315
if( bs == N ) {
316316
break;
317317
}
318318
}
319319
}
320320

321-
int main( int argc, char ** argv ) {
321+
int main( int argc, char **argv ) {
322322
// defaults
323323
bool printUsage = false;
324324
inpdata in;

0 commit comments

Comments
 (0)