libflame revision_anchor
Functions
FLASH_View.c File Reference

(r)

Functions

FLA_Error FLASH_Part_create_2x1 (FLA_Obj A, FLA_Obj *AT, FLA_Obj *AB, dim_t n_rows, FLA_Side side)
 
FLA_Error FLASH_Part_create_1x2 (FLA_Obj A, FLA_Obj *AL, FLA_Obj *AR, dim_t n_cols, FLA_Side side)
 
FLA_Error FLASH_Part_create_2x2 (FLA_Obj A, FLA_Obj *ATL, FLA_Obj *ATR, FLA_Obj *ABL, FLA_Obj *ABR, dim_t n_rows, dim_t n_cols, FLA_Side side)
 
FLA_Error FLASH_Obj_adjust_views (FLA_Bool attach_buffer, dim_t offm, dim_t offn, dim_t m, dim_t n, FLA_Obj A, FLA_Obj *S)
 
FLA_Error FLASH_Obj_adjust_views_hierarchy (FLA_Bool attach_buffer, dim_t offm, dim_t offn, dim_t m, dim_t n, FLA_Obj A, FLA_Obj *S)
 
FLA_Error FLASH_Part_free_2x1 (FLA_Obj *AT, FLA_Obj *AB)
 
FLA_Error FLASH_Part_free_1x2 (FLA_Obj *AL, FLA_Obj *AR)
 
FLA_Error FLASH_Part_free_2x2 (FLA_Obj *ATL, FLA_Obj *ATR, FLA_Obj *ABL, FLA_Obj *ABR)
 
dim_t FLASH_Obj_scalar_length (FLA_Obj H)
 
dim_t FLASH_Obj_scalar_width (FLA_Obj H)
 
dim_t FLASH_Obj_scalar_min_dim (FLA_Obj H)
 
dim_t FLASH_Obj_scalar_max_dim (FLA_Obj H)
 
dim_t FLASH_Obj_scalar_vector_dim (FLA_Obj H)
 
dim_t FLASH_Obj_scalar_row_offset (FLA_Obj H)
 
dim_t FLASH_Obj_scalar_col_offset (FLA_Obj H)
 
dim_t FLASH_Obj_scalar_length_tl (FLA_Obj H)
 
dim_t FLASH_Obj_scalar_width_tl (FLA_Obj H)
 
FLA_Error FLASH_Obj_show (char *header, FLA_Obj H, char *elem_format, char *footer)
 
FLA_Error FLASH_Obj_show_hierarchy (FLA_Obj H, dim_t i, char *elem_format)
 

Function Documentation

◆ FLASH_Obj_adjust_views()

FLA_Error FLASH_Obj_adjust_views ( FLA_Bool  attach_buffer,
dim_t  offm,
dim_t  offn,
dim_t  m,
dim_t  n,
FLA_Obj  A,
FLA_Obj S 
)
276{
277
278 FLASH_Obj_adjust_views_hierarchy( attach_buffer, offm, offn, m, n, A, S );
279
280 return FLA_SUCCESS;
281}
FLA_Error FLASH_Obj_adjust_views_hierarchy(FLA_Bool attach_buffer, dim_t offm, dim_t offn, dim_t m, dim_t n, FLA_Obj A, FLA_Obj *S)
Definition FLASH_View.c:283
int i
Definition bl1_axmyv2.c:145

References FLASH_Obj_adjust_views_hierarchy().

Referenced by FLASH_Obj_create_conf_to(), FLASH_Part_create_1x2(), FLASH_Part_create_2x1(), and FLASH_Part_create_2x2().

◆ FLASH_Obj_adjust_views_hierarchy()

FLA_Error FLASH_Obj_adjust_views_hierarchy ( FLA_Bool  attach_buffer,
dim_t  offm,
dim_t  offn,
dim_t  m,
dim_t  n,
FLA_Obj  A,
FLA_Obj S 
)
284{
285 FLA_Obj ATL, ATR,
286 ABL, ABR;
287
288 FLA_Obj STL, STR,
289 SBL, SBR;
290
291 // Base case.
292 if ( FLA_Obj_elemtype( A ) == FLA_SCALAR )
293 {
294 // Repartition to exclude elements above and to the left of our
295 // submatrix of interest.
296 FLA_Part_2x2( A, &ATL, &ATR,
297 &ABL, &ABR, offm, offn, FLA_TL );
298 FLA_Part_2x2( *S, &STL, &STR,
299 &SBL, &SBR, offm, offn, FLA_TL );
300
301 // Overwrite the existing views with ones that have updated offsets.
302 A = ABR;
303 *S = SBR;
304
305 // Repartition to exclude elements below and to the right of our
306 // submatrix of interest.
307 FLA_Part_2x2( A, &ATL, &ATR,
308 &ABL, &ABR, m, n, FLA_TL );
309 FLA_Part_2x2( *S, &STL, &STR,
310 &SBL, &SBR, m, n, FLA_TL );
311
312 // Overwrite the existing view of S with the view of A so that S
313 // Refers to the correct base object.
314 A = ATL;
315 *S = STL;
316
317 // Adjust the _inner fields in the view to reflect the number of
318 // elements we have in each dimension.
319 S->m_inner = m;
320 S->n_inner = n;
321
322 // Copy over buffer, stride, and object ID information if requested.
323 if ( attach_buffer )
324 {
325 // Copy over the address of the numerical data buffer and its
326 // corresponding row and column strides. This is obviously
327 // necessary since we are creating a hierarchial view into an
328 // existing hierarhical matrix, not a separate/new matrix
329 // altogether.
330 S->base->buffer = A.base->buffer;
331 S->base->rs = A.base->rs;
332 S->base->cs = A.base->cs;
333
334 // Copy over the id field of the original matrix. This is used
335 // by SuperMatrix to distinguish between distinct hierarchical
336 // matrices. Since again, we are not creating a new matrix, we
337 // will use the original object's id value.
338 S->base->id = A.base->id;
339 }
340 }
341 else // if ( FLA_Obj_elemtype( A ) == FLA_MATRIX )
342 {
343 FLA_Obj AL, AR, A0, A1, A2;
344
345 FLA_Obj SL, SR, S0, S1, S2;
346
347 FLA_Obj A1T, A01,
348 A1B, A11,
349 A21;
350
351 FLA_Obj S1T, S01,
352 S1B, S11,
353 S21;
372
373 // Acquire the scalar length and width of the top-left (full) block
374 // at the current hierarchical level.
377/*
378printf( "-----------------\n" );
379printf( "b_m/n_full: %d %d\n", b_m_full, b_n_full );
380printf( "offm/n: %d %d\n", offm, offn );
381printf( "r/c offsets: %d %d\n", FLA_Obj_row_offset( A ), FLA_Obj_col_offset( A ) );
382*/
383 // Compute the offsets for the top-left corner of the submatrix of
384 // interest relative to the view at the current level of the
385 // hierarchy of A.
388
389 // Compute the offsets for the top-left corner of the submatrix of
390 // interest in absolute units, from the top-left edge of the
391 // overall allocated matrix. This will be used to partition into S
392 // Since its view has (presumably) not yet been changed since it
393 // was created.
394 offm_abs = offm / b_m_full;
395 offn_abs = offn / b_n_full;
396/*
397printf( "offm/n_relA: %d %d\n", offm_relA, offn_relA );
398printf( "offm/n_abs: %d %d\n", offm_abs, offn_abs );
399*/
400 // Repartition to exclude blocks above and to the left of our
401 // submatrix of interest.
402 FLA_Part_2x2( A, &ATL, &ATR,
404 FLA_Part_2x2( *S, &STL, &STR,
406/*
407printf( "ABR.offm/n %d %d\n", FLA_Obj_row_offset( ABR ), FLA_Obj_col_offset( ABR ) );
408printf( "ABR is %d %d\n", FLA_Obj_length( ABR ), FLA_Obj_width( ABR ) );
409printf( "SBR.offm/n %d %d\n", FLA_Obj_row_offset( SBR ), FLA_Obj_col_offset( SBR ) );
410printf( "SBR is %d %d\n", FLA_Obj_length( SBR ), FLA_Obj_width( SBR ) );
411*/
412 // Overwrite the existing views with ones that have updated offsets
413 // (for this level in the hierarchy).
414 A = ABR;
415 *S = SBR;
416
417 // Compute the new offsets within SBR, which is the remaining
418 // distance after you subtract out the distance spanned by the
419 // partitioning we just did.
420 offm_rem = offm - offm_abs * b_m_full;
421 offn_rem = offn - offn_abs * b_n_full;
422
423//printf( "offm/n_rem: %d %d\n", offm_rem, offn_rem );
424
425 // Compute a new set of offsets corresponding to the bottom-right
426 // edge of the desired submatrix. We'll use this to partition away
427 // the remaining (bottom and right) parts of the FLASH matrix at
428 // this level.
429 offm_cur = ( offm_rem + m ) / b_m_full;
430 offn_cur = ( offn_rem + n ) / b_n_full;
431 offm_cur += ( (offm_rem + m) % b_m_full ? 1 : 0 );
432 offn_cur += ( (offn_rem + n) % b_n_full ? 1 : 0 );
433
434//printf( "offm/n_cur: %d %d\n", offm_cur, offn_cur );
435
436 // Repartition to exclude blocks below and to the right of our
437 // submatrix of interest.
438 FLA_Part_2x2( A, &ATL, &ATR,
440 FLA_Part_2x2( *S, &STL, &STR,
442/*
443printf( "ATL.offm/n %d %d\n", FLA_Obj_row_offset( ATL ), FLA_Obj_col_offset( ATL ) );
444printf( "ATL is %d %d\n", FLA_Obj_length( ATL ), FLA_Obj_width( ATL ) );
445printf( "STL.offm/n %d %d\n", FLA_Obj_row_offset( STL ), FLA_Obj_col_offset( STL ) );
446printf( "STL is %d %d\n", FLA_Obj_length( STL ), FLA_Obj_width( STL ) );
447*/
448
449 // Overwrite the existing views with ones that have updated offsets
450 // (for this level in the hierarchy).
451 A = ATL;
452 *S = STL;
453
454 // Adjust the _inner fields in the view to reflect the number of
455 // elements we will eventually have in each dimension.
456 S->m_inner = m;
457 S->n_inner = n;
458
459 // Initialize a counter that keeps track of the n offset relative to
460 // the top-left most edge of the submatrix of interest.
461 n_behind = 0;
462
463 FLA_Part_1x2( A, &AL, &AR, 0, FLA_LEFT );
464 FLA_Part_1x2( *S, &SL, &SR, 0, FLA_LEFT );
465
466 while ( FLA_Obj_width( AL ) < FLA_Obj_width( A ) )
467 {
468 FLA_Repart_1x2_to_1x3( AL, /**/ AR, &A0, /**/ &A1, &A2,
469 1, FLA_RIGHT );
470 FLA_Repart_1x2_to_1x3( SL, /**/ SR, &S0, /**/ &S1, &S2,
471 1, FLA_RIGHT );
472
473 // -------------------------------------------------------------
474
475 // Set the n offset for the next levels of recursion based
476 // on which panel of A we are in.
477 if ( FLA_Obj_width( AL ) == 0 ) offn_next = offn_rem;
478 else offn_next = 0;
479
480 // Compute the number of columns left to be visited in the
481 // submatrix of interset.
482 n_ahead = n - n_behind;
483
484 // Set the n dimensions for the next level of recursion
485 // depending on whether the submatrix continues beyond the
486 // current block.
488 else n_next = n_ahead;
489
490 // Initialize a counter that keeps track of the m offset relative
491 // to the top-left most edge of the submatrix of interest.
492 m_behind = 0;
493
495 &A1B, 0, FLA_TOP );
497 &S1B, 0, FLA_TOP );
498
499 while ( FLA_Obj_length( A1T ) < FLA_Obj_length( A1 ) )
500 {
502 /* ** */ /* ** */
503 &A11,
504 A1B, &A21, 1, FLA_BOTTOM );
506 /* ** */ /* ** */
507 &S11,
508 S1B, &S21, 1, FLA_BOTTOM );
509
510 // -------------------------------------------------------------
511
512 // Set the m offset for the next levels of recursion based
513 // on which block of A1 we are in.
514 if ( FLA_Obj_length( A1T ) == 0 ) offm_next = offm_rem;
515 else offm_next = 0;
516
517 // Compute the number of rows left to be visited in the
518 // submatrix of interset.
519 m_ahead = m - m_behind;
520
521 // Set the m dimensions for the next level of recursion
522 // depending on whether the submatrix continues beyond the
523 // current block.
525 else m_next = m_ahead;
526
527//printf( "offm/n_next m/n_next: %d %d %d %d\n", offm_next, offn_next, m_next, n_next );
528 // Recursively call ourselves with new, smaller offsets
529 // and the submatrix corresponding to FLASH blocks captured by ABR.
531 offm_next,
532 offn_next,
533 m_next,
534 n_next,
537
538 // Increment m_behind to keep track of our absolute m offset.
539 m_behind += m_next;
540
541 // -------------------------------------------------------------
542
544 A11,
545 /* ** */ /* ** */
546 &A1B, A21, FLA_TOP );
548 S11,
549 /* ** */ /* ** */
550 &S1B, S21, FLA_TOP );
551 }
552
553 // Increment n_behind to keep track of our absolute n offset.
554 n_behind += n_next;
555
556 // -------------------------------------------------------------
557
558 FLA_Cont_with_1x3_to_1x2( &AL, /**/ &AR, A0, A1, /**/ A2,
559 FLA_LEFT );
560 FLA_Cont_with_1x3_to_1x2( &SL, /**/ &SR, S0, S1, /**/ S2,
561 FLA_LEFT );
562 }
563 }
564
565 return FLA_SUCCESS;
566}
dim_t FLASH_Obj_scalar_length_tl(FLA_Obj H)
Definition FLASH_View.c:723
dim_t FLASH_Obj_scalar_width_tl(FLA_Obj H)
Definition FLASH_View.c:737
FLA_Error FLA_Part_2x2(FLA_Obj A, FLA_Obj *A11, FLA_Obj *A12, FLA_Obj *A21, FLA_Obj *A22, dim_t mb, dim_t nb, FLA_Quadrant quadrant)
Definition FLA_View.c:17
FLA_Error FLA_Cont_with_3x1_to_2x1(FLA_Obj *AT, FLA_Obj A0, FLA_Obj A1, FLA_Obj *AB, FLA_Obj A2, FLA_Side side)
Definition FLA_View.c:428
FLA_Error FLA_Repart_2x1_to_3x1(FLA_Obj AT, FLA_Obj *A0, FLA_Obj *A1, FLA_Obj AB, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition FLA_View.c:226
FLA_Error FLA_Cont_with_1x3_to_1x2(FLA_Obj *AL, FLA_Obj *AR, FLA_Obj A0, FLA_Obj A1, FLA_Obj A2, FLA_Side side)
Definition FLA_View.c:475
dim_t FLA_Obj_width(FLA_Obj obj)
Definition FLA_Query.c:123
FLA_Error FLA_Part_1x2(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition FLA_View.c:110
FLA_Error FLA_Part_2x1(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition FLA_View.c:76
dim_t FLA_Obj_col_offset(FLA_Obj obj)
Definition FLA_Query.c:186
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
FLA_Error FLA_Repart_1x2_to_1x3(FLA_Obj AL, FLA_Obj AR, FLA_Obj *A0, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition FLA_View.c:267
FLA_Elemtype FLA_Obj_elemtype(FLA_Obj obj)
Definition FLA_Query.c:51
dim_t FLA_Obj_row_offset(FLA_Obj obj)
Definition FLA_Query.c:180
unsigned long dim_t
Definition FLA_type_defs.h:71
Definition FLA_type_defs.h:159

References FLA_Obj_view::base, FLA_Obj_struct::buffer, FLA_Obj_struct::cs, FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_Obj_col_offset(), FLA_Obj_elemtype(), FLA_Obj_length(), FLA_Obj_row_offset(), FLA_Obj_width(), FLA_Part_1x2(), FLA_Part_2x1(), FLA_Part_2x2(), FLA_Repart_1x2_to_1x3(), FLA_Repart_2x1_to_3x1(), FLASH_Obj_adjust_views_hierarchy(), FLASH_Obj_scalar_length_tl(), FLASH_Obj_scalar_width_tl(), FLA_Obj_struct::id, FLA_Obj_view::m_inner, FLA_Obj_view::n_inner, and FLA_Obj_struct::rs.

Referenced by FLASH_Obj_adjust_views(), and FLASH_Obj_adjust_views_hierarchy().

◆ FLASH_Obj_scalar_col_offset()

dim_t FLASH_Obj_scalar_col_offset ( FLA_Obj  H)

◆ FLASH_Obj_scalar_length()

dim_t FLASH_Obj_scalar_length ( FLA_Obj  H)
601{
602 FLA_Obj HT, H0,
603 HB, H1,
604 H2;
605 FLA_Obj* H1p;
606
607 dim_t b = 0;
608
609 if ( FLA_Obj_elemtype( H ) == FLA_SCALAR )
610 return FLA_Obj_length( H );
611
612 if ( FLA_Obj_length( H ) == 0 )
613 return 0;
614
615 FLA_Part_2x1( H, &HT,
616 &HB, 0, FLA_TOP );
617
618 while ( FLA_Obj_length( HT ) < FLA_Obj_length( H ) )
619 {
621 /* ** */ /* ** */
622 &H1,
623 HB, &H2, 1, FLA_BOTTOM );
624
625 /*------------------------------------------------------------*/
626
628 b += H1p->m_inner;
629
630 /*------------------------------------------------------------*/
631
633 H1,
634 /* ** */ /* ** */
635 &HB, H2, FLA_TOP );
636 }
637
638 return b;
639}

References FLA_Cont_with_3x1_to_2x1(), FLA_Obj_elemtype(), FLA_Obj_length(), FLA_Part_2x1(), FLA_Repart_2x1_to_3x1(), and FLA_Obj_view::m_inner.

Referenced by FLA_Check_submatrix_dims_and_offset(), FLA_Obj_copy_view(), FLASH_Axpy_hierarchy(), FLASH_Copy_hierarchy(), FLASH_LU_find_zero_on_diagonal(), FLASH_Obj_create_conf_to(), FLASH_Obj_create_flat_conf_to_hier(), FLASH_Obj_scalar_max_dim(), FLASH_Obj_scalar_min_dim(), FLASH_Obj_scalar_vector_dim(), FLASH_Obj_show(), FLASH_Part_create_1x2(), FLASH_Part_create_2x1(), and FLASH_Part_create_2x2().

◆ FLASH_Obj_scalar_length_tl()

dim_t FLASH_Obj_scalar_length_tl ( FLA_Obj  H)

◆ FLASH_Obj_scalar_max_dim()

dim_t FLASH_Obj_scalar_max_dim ( FLA_Obj  H)
682{
683 return max( FLASH_Obj_scalar_length( H ),
685}
dim_t FLASH_Obj_scalar_length(FLA_Obj H)
Definition FLASH_View.c:600
dim_t FLASH_Obj_scalar_width(FLA_Obj H)
Definition FLASH_View.c:641

References FLASH_Obj_scalar_length(), and FLASH_Obj_scalar_width().

◆ FLASH_Obj_scalar_min_dim()

dim_t FLASH_Obj_scalar_min_dim ( FLA_Obj  H)

◆ FLASH_Obj_scalar_row_offset()

dim_t FLASH_Obj_scalar_row_offset ( FLA_Obj  H)

◆ FLASH_Obj_scalar_vector_dim()

dim_t FLASH_Obj_scalar_vector_dim ( FLA_Obj  H)

◆ FLASH_Obj_scalar_width()

dim_t FLASH_Obj_scalar_width ( FLA_Obj  H)

◆ FLASH_Obj_scalar_width_tl()

dim_t FLASH_Obj_scalar_width_tl ( FLA_Obj  H)

◆ FLASH_Obj_show()

FLA_Error FLASH_Obj_show ( char header,
FLA_Obj  H,
char elem_format,
char footer 
)
752{
753 if ( FLA_Obj_elemtype( H ) == FLA_SCALAR )
754 {
755 // Display the flat object.
757 }
758 else
759 {
762 dim_t i_abs;
764
765 // We want to print all m rows in the FLASH view.
767
768 // Get the scalar offset of the overall FLASH view relative to the
769 // top-left corner of the overall object to which the view belongs.
771
772//printf( "flash_view_show: %d\n", m_scalar );
773//printf( "flash_view_show: %d\n", offm_scalar );
774
775 printf( "%s\n", header );
776
777 for ( i_view = 0; i_view < m_scalar; ++i_view )
778 {
779 // Convert the relative view index to an absolute index.
781
782 // Print the ith row of the FLASH object H.
784 printf( "\n" );
785 }
786
787 printf( "%s\n", footer );
788 }
789
790 return FLA_SUCCESS;
791}
FLA_Error FLASH_Obj_show_hierarchy(FLA_Obj H, dim_t i, char *elem_format)
Definition FLASH_View.c:793
FLA_Error FLA_Obj_show(char *s1, FLA_Obj A, char *format, char *s2)
Definition FLA_Misc.c:420

References FLA_Obj_elemtype(), FLA_Obj_show(), FLASH_Obj_scalar_length(), FLASH_Obj_scalar_row_offset(), and FLASH_Obj_show_hierarchy().

◆ FLASH_Obj_show_hierarchy()

FLA_Error FLASH_Obj_show_hierarchy ( FLA_Obj  H,
dim_t  i,
char elem_format 
)
794{
795 if ( FLA_Obj_elemtype( H ) == FLA_SCALAR )
796 {
797 FLA_Datatype datatype = FLA_Obj_datatype( H );
798 dim_t m = FLA_Obj_width( H );
799 dim_t rs = FLA_Obj_row_stride( H );
800 dim_t cs = FLA_Obj_col_stride( H );
801 dim_t j;
802
803 // At this point, i is an absolute row index. We subtract out the
804 // row offset of the view so that the index is relative to the view.
805 i = i - FLA_Obj_row_offset( H );
806
807 if ( datatype == FLA_INT )
808 {
809 int* buffer = FLA_Obj_buffer_at_view( H );
810
811 for ( j = 0; j < m; ++j )
812 {
813 printf( elem_format, buffer[ j*cs + i*rs ] );
814 printf( " " );
815 }
816 }
817 else if ( datatype == FLA_FLOAT )
818 {
819 float* buffer = FLA_Obj_buffer_at_view( H );
820
821 for ( j = 0; j < m; ++j )
822 {
823 printf( elem_format, buffer[ j*cs + i*rs ] );
824 printf( " " );
825 }
826 }
827 else if ( datatype == FLA_DOUBLE )
828 {
829 double* buffer = FLA_Obj_buffer_at_view( H );
830
831 for ( j = 0; j < m; ++j )
832 {
833 printf( elem_format, buffer[ j*cs + i*rs ] );
834 printf( " " );
835 }
836 }
837 else if ( datatype == FLA_COMPLEX )
838 {
839 scomplex* buffer = FLA_Obj_buffer_at_view( H );
840
841 for ( j = 0; j < m; ++j )
842 {
843 printf( elem_format, buffer[ j*cs + i*rs ].real,
844 buffer[ j*cs + i*rs ].imag );
845 printf( " " );
846 }
847 }
848 else if ( datatype == FLA_DOUBLE_COMPLEX )
849 {
850 dcomplex* buffer = FLA_Obj_buffer_at_view( H );
851
852 for ( j = 0; j < m; ++j )
853 {
854 printf( elem_format, buffer[ j*cs + i*rs ].real,
855 buffer[ j*cs + i*rs ].imag );
856 printf( " " );
857 }
858 }
859 else
860 {
862 }
863 }
864 else
865 {
866 FLA_Obj HT,
867 HB;
868 FLA_Obj HBL, HBR, H10, H11, H12;
872
873 // Get the scalar length of the top-left block.
875
876#if 0
877printf( "\n------------------------\n" );
878printf( "b_m_scalar %d\n", b_m_scalar );
879printf( "i %d\n", i );
880#endif
881
882 // Compute the offset of the matrix block, relative to the current
883 // view, that contains the ith row of the matrix.
885 i_next = ( i ) % b_m_scalar;
886
887#if 0
888printf( "row offset %d\n", FLA_Obj_row_offset( H ) );
889printf( "offm_local %d\n", offm_local );
890printf( "i_next %d\n", i_next );
891#endif
892
893 FLA_Part_2x1( H, &HT,
894 &HB, offm_local, FLA_TOP );
895
896 FLA_Part_1x2( HB, &HBL, &HBR, 0, FLA_LEFT );
897
898 while ( FLA_Obj_width( HBL ) < FLA_Obj_width( HB ) )
899 {
900 FLA_Repart_1x2_to_1x3( HBL, /**/ HBR, &H10, /**/ &H11, &H12,
901 1, FLA_RIGHT );
902
903 // ------------------------------------------------------
904
907
908 // ------------------------------------------------------
909
910 FLA_Cont_with_1x3_to_1x2( &HBL, /**/ &HBR, H10, H11, /**/ H12,
911 FLA_LEFT );
912 }
913 }
914
915 return FLA_SUCCESS;
916}
float real
Definition FLA_f2c.h:30
dim_t FLA_Obj_row_stride(FLA_Obj obj)
Definition FLA_Query.c:167
dim_t FLA_Obj_col_stride(FLA_Obj obj)
Definition FLA_Query.c:174
void * FLA_Obj_buffer_at_view(FLA_Obj obj)
Definition FLA_Query.c:215
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition FLA_Query.c:13
int FLA_Datatype
Definition FLA_type_defs.h:49
rho_c imag
Definition bl1_axpyv2bdotaxpy.c:483
Definition blis_type_defs.h:138
Definition blis_type_defs.h:133

References FLA_Cont_with_1x3_to_1x2(), FLA_Obj_buffer_at_view(), FLA_Obj_col_stride(), FLA_Obj_datatype(), FLA_Obj_elemtype(), FLA_Obj_row_offset(), FLA_Obj_row_stride(), FLA_Obj_width(), FLA_Part_1x2(), FLA_Part_2x1(), FLA_Repart_1x2_to_1x3(), FLASH_Obj_scalar_length_tl(), FLASH_Obj_show_hierarchy(), i, and imag.

Referenced by FLASH_Obj_show(), and FLASH_Obj_show_hierarchy().

◆ FLASH_Part_create_1x2()

FLA_Error FLASH_Part_create_1x2 ( FLA_Obj  A,
FLA_Obj AL,
FLA_Obj AR,
dim_t  n_cols,
FLA_Side  side 
)
105{
107 dim_t m_A, n_A;
109 dim_t m_AL, n_AL;
110 dim_t m_AR, n_AR;
111 dim_t depth;
112 dim_t* b_m;
113 dim_t* b_n;
117
120
121 // Safeguard: if n_cols > n, reduce n_cols to n.
124
125 // Acquire various properties of the hierarchical matrix object.
134
135 // Allocate a pair of temporary arrays for the blocksizes, whose lengths
136 // are equal to the object's hierarchical depth.
137 b_m = ( dim_t* ) FLA_malloc( depth * sizeof( dim_t ) );
138 b_n = ( dim_t* ) FLA_malloc( depth * sizeof( dim_t ) );
139
140 // Accumulate the blocksizes into the blocksize buffers.
142
143 // Adjust n_cols to be (n - n_cols) if the side specified is on the
144 // right so that the right values get assigned below.
145 if ( side == FLA_RIGHT ) n_cols = n_A - n_cols;
146
147 // Set the dimensions of the partitions.
148 m_AL = m_A;
149 n_AL = n_cols;
150 m_AR = m_A;
151 n_AR = n_A - n_cols;
152
153 // Set the offsets.
154 offm_AL = offm_A + 0;
155 offn_AL = offn_A + 0;
156 offm_AR = offm_A + 0;
157 offn_AR = offn_A + n_AL;
158
159 // Create bufferless hierarhical objects that have the desired dimensions
160 // for the views.
163
164 // Recursively walk the hierarchy and adjust the views so that they
165 // collectively refer to the absolute offsets given, and attach the
166 // leaf-level numerical buffers of A to the new views.
169
170 // Free the temporary blocksize buffers.
171 FLA_free( b_m );
172 FLA_free( b_n );
173
174 return FLA_SUCCESS;
175}
FLA_Error FLASH_Obj_adjust_views(FLA_Bool attach_buffer, dim_t offm, dim_t offn, dim_t m, dim_t n, FLA_Obj A, FLA_Obj *S)
Definition FLASH_View.c:275
dim_t FLASH_Obj_blocksizes(FLA_Obj H, dim_t *b_m, dim_t *b_n)
Definition FLASH_Obj.c:49
FLA_Error FLASH_Obj_create_without_buffer_ext(FLA_Datatype datatype, dim_t m, dim_t n, dim_t depth, dim_t *b_m, dim_t *b_n, FLA_Obj *H)
Definition FLASH_Obj.c:167
dim_t FLASH_Obj_depth(FLA_Obj H)
Definition FLASH_Obj.c:20
FLA_Datatype FLASH_Obj_datatype(FLA_Obj H)
Definition FLASH_Obj.c:14
FLA_Error FLA_Part_1x2_check(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition FLA_Part_1x2_check.c:13
void FLA_free(void *ptr)
Definition FLA_Memory.c:247
void * FLA_malloc(size_t size)
Definition FLA_Memory.c:111
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18

References FLA_Check_error_level(), FLA_free(), FLA_malloc(), FLA_Part_1x2_check(), FLASH_Obj_adjust_views(), FLASH_Obj_base_scalar_length(), FLASH_Obj_base_scalar_width(), FLASH_Obj_blocksizes(), FLASH_Obj_create_without_buffer_ext(), FLASH_Obj_datatype(), FLASH_Obj_depth(), FLASH_Obj_scalar_col_offset(), FLASH_Obj_scalar_length(), FLASH_Obj_scalar_row_offset(), and FLASH_Obj_scalar_width().

◆ FLASH_Part_create_2x1()

FLA_Error FLASH_Part_create_2x1 ( FLA_Obj  A,
FLA_Obj AT,
FLA_Obj AB,
dim_t  n_rows,
FLA_Side  side 
)
16{
18 dim_t m_A, n_A;
23 dim_t* b_m;
24 dim_t* b_n;
28
31 AB, n_rows, side );
32
33 // Safeguard: if n_rows > m, reduce n_rows to m.
36
37 // Acquire various properties of the hierarchical matrix view.
46
47 // Allocate a pair of temporary arrays for the blocksizes, whose lengths
48 // are equal to the object's hierarchical depth.
49 b_m = ( dim_t* ) FLA_malloc( depth * sizeof( dim_t ) );
50 b_n = ( dim_t* ) FLA_malloc( depth * sizeof( dim_t ) );
51
52 // Accumulate the blocksizes into the blocksize buffers.
54
55 // Adjust n_rows to be (m - n_rows) if the side specified is on the
56 // bottom so that the right values get assigned below.
57 if ( side == FLA_BOTTOM ) n_rows = m_A - n_rows;
58
59 // Set the dimensions of the partitions.
60 m_AT = n_rows;
61 n_AT = n_A;
62 m_AB = m_A - n_rows;
63 n_AB = n_A;
64
65 // Set the offsets.
66 offm_AT = offm_A + 0;
67 offn_AT = offn_A + 0;
69 offn_AB = offn_A + 0;
70
71 // Create bufferless hierarhical objects that have the desired dimensions
72 // for the views.
75
76/*
77printf( "depth %d\n", depth );
78printf( "b_m/n[0] %d %d\n", b_m[0], b_n[0] );
79printf( "b_m/n_tl %d %d\n", FLASH_Obj_scalar_length_tl( A ), FLASH_Obj_scalar_width_tl( A ) );
80printf( "m/n_A_base %d %d\n", m_A_base, n_A_base );
81printf( "offm/n_AT: %d %d\n", offm_AT, offn_AT );
82printf( "m/n_AT: %d %d\n", m_AT, n_AT );
83printf( "offm/n_AB: %d %d\n", offm_AB, offn_AB );
84printf( "m/n_AB: %d %d\n", m_AB, n_AB );
85printf( "A is %d %d\n", FLA_Obj_length( A ), FLA_Obj_width( A ) );
86printf( "AT is %d %d\n", FLA_Obj_length( *AT ), FLA_Obj_width( *AT ) );
87printf( "AB is %d %d\n", FLA_Obj_length( *AB ), FLA_Obj_width( *AB ) );
88*/
89
90 // Recursively walk the hierarchy and adjust the views so that they
91 // collectively refer to the absolute offsets given, and attach the
92 // leaf-level numerical buffers of A to the new views.
95
96 // Free the temporary blocksize buffers.
97 FLA_free( b_m );
98 FLA_free( b_n );
99
100 return FLA_SUCCESS;
101}
FLA_Error FLA_Part_2x1_check(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition FLA_Part_2x1_check.c:13

References FLA_Check_error_level(), FLA_free(), FLA_malloc(), FLA_Part_2x1_check(), FLASH_Obj_adjust_views(), FLASH_Obj_base_scalar_length(), FLASH_Obj_base_scalar_width(), FLASH_Obj_blocksizes(), FLASH_Obj_create_without_buffer_ext(), FLASH_Obj_datatype(), FLASH_Obj_depth(), FLASH_Obj_scalar_col_offset(), FLASH_Obj_scalar_length(), FLASH_Obj_scalar_row_offset(), and FLASH_Obj_scalar_width().

Referenced by FLASH_CAQR_UT_inc_solve(), and FLASH_QR_UT_inc_solve().

◆ FLASH_Part_create_2x2()

FLA_Error FLASH_Part_create_2x2 ( FLA_Obj  A,
FLA_Obj ATL,
FLA_Obj ATR,
FLA_Obj ABL,
FLA_Obj ABR,
dim_t  n_rows,
dim_t  n_cols,
FLA_Side  side 
)
180{
183 dim_t m_A, n_A;
188 dim_t depth;
189 dim_t* b_m;
190 dim_t* b_n;
196
199 ABL, ABR, n_rows, n_cols, side );
200
201 // Safeguard: if n_rows > m, reduce n_rows to m.
204
205 // Safeguard: if n_cols > n, reduce n_cols to n.
208
209 // Acquire various properties of the hierarchical matrix object.
218
219 // Allocate a pair of temporary arrays for the blocksizes, whose lengths
220 // are equal to the object's hierarchical depth.
221 b_m = ( dim_t* ) FLA_malloc( depth * sizeof( dim_t ) );
222 b_n = ( dim_t* ) FLA_malloc( depth * sizeof( dim_t ) );
223
224 // Accumulate the blocksizes into the blocksize buffers.
226
227 // Adjust n_rows to be (m - n_rows) if the quadrant specified is on
228 // the bottom so that the right values get assigned below. Do the same
229 // for n_cols.
230 if ( side == FLA_BL || side == FLA_BR ) n_rows = m_A - n_rows;
231 if ( side == FLA_TR || side == FLA_BR ) n_cols = n_A - n_cols;
232
233 // Set the dimensions of the partitions.
234 m_ATL = n_rows;
235 n_ATL = n_cols;
236 m_ABL = m_A - n_rows;
237 n_ABL = n_cols;
238 m_ATR = n_rows;
239 n_ATR = n_A - n_cols;
240 m_ABR = m_A - n_rows;
241 n_ABR = n_A - n_cols;
242
243 // Set the offsets.
244 offm_ATL = offm_A + 0;
245 offn_ATL = offn_A + 0;
247 offn_ABL = offn_A + 0;
248 offm_ATR = offm_A + 0;
252
253 // Create bufferless hierarhical objects that have the desired dimensions
254 // for the views.
259
260 // Recursively walk the hierarchy and adjust the views so that they
261 // collectively refer to the absolute offsets given, and attach the
262 // leaf-level numerical buffers of A to the new views.
267
268 // Free the temporary blocksize buffers.
269 FLA_free( b_m );
270 FLA_free( b_n );
271
272 return FLA_SUCCESS;
273}
FLA_Error FLA_Part_2x2_check(FLA_Obj A, FLA_Obj *A11, FLA_Obj *A12, FLA_Obj *A21, FLA_Obj *A22, dim_t mb, dim_t nb, FLA_Quadrant quadrant)
Definition FLA_Part_2x2_check.c:13

References FLA_Check_error_level(), FLA_free(), FLA_malloc(), FLA_Part_2x2_check(), FLASH_Obj_adjust_views(), FLASH_Obj_base_scalar_length(), FLASH_Obj_base_scalar_width(), FLASH_Obj_blocksizes(), FLASH_Obj_create_without_buffer_ext(), FLASH_Obj_datatype(), FLASH_Obj_depth(), FLASH_Obj_scalar_col_offset(), FLASH_Obj_scalar_length(), FLASH_Obj_scalar_row_offset(), and FLASH_Obj_scalar_width().

Referenced by FLASH_Axpy_flat_to_hier(), FLASH_Axpy_hier_to_flat(), FLASH_Copy_flat_to_hier(), and FLASH_Copy_hier_to_flat().

◆ FLASH_Part_free_1x2()

FLA_Error FLASH_Part_free_1x2 ( FLA_Obj AL,
FLA_Obj AR 
)
582{
585
586 return FLA_SUCCESS;
587}
void FLASH_Obj_free_without_buffer(FLA_Obj *H)
Definition FLASH_Obj.c:674

References FLASH_Obj_free_without_buffer().

◆ FLASH_Part_free_2x1()

FLA_Error FLASH_Part_free_2x1 ( FLA_Obj AT,
FLA_Obj AB 
)

◆ FLASH_Part_free_2x2()

FLA_Error FLASH_Part_free_2x2 ( FLA_Obj ATL,
FLA_Obj ATR,
FLA_Obj ABL,
FLA_Obj ABR 
)