ScottKolo/suitesparse-matrix-collection-website

View on GitHub
app/views/collection_matrices/show.html.haml

Summary

Maintainability
Test Coverage
=provide(:title, "#{@matrix.group}/#{@matrix.name}")
=provide(:description, "Matrix details for #{@matrix.group}/#{@matrix.name}")

%h2= "#{@matrix.group}/#{@matrix.name}"

%div{style: "padding-bottom: 20px;"}
  .h4= @matrix.description
  .row
    .col-md-6.col-md-pull-6
      %table.table.table-striped
        %tbody
          %tr
            %th Name
            %td= @matrix.name
          %tr
            %th Group
            %td= link_to "#{@matrix.group}", "/#{@matrix.group}"
          %tr
            %th Matrix ID
            %td= @matrix.matrix_id
          %tr
            %th
              Num Rows
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:num_rows)}
                %span.fas.fa-question-circle
            %td= number_with_delimiter(@matrix.num_rows, delimiter: ',')
          %tr
            %th 
              Num Cols
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:num_cols)}
                %span.fas.fa-question-circle
            %td= number_with_delimiter(@matrix.num_cols, delimiter: ',')
          %tr
            %th
              Nonzeros
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:nonzeros)}
                %span.fas.fa-question-circle
            %td= number_with_delimiter(@matrix.nonzeros, delimiter: ',')
          %tr
            %th
              Pattern Entries
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:entries)}
                %span.fas.fa-question-circle
            %td= number_with_delimiter(@matrix.nonzeros+@matrix.num_explicit_zeros, delimiter: ',') unless (@matrix.nonzeros.nil? or @matrix.num_explicit_zeros.nil?)
          %tr
            %th
              Kind
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:kind)}
                %span.fas.fa-question-circle
            %td= @matrix.kind.titleize.gsub(/2\sD/, '2D').gsub(/3\sD/, '3D') unless @matrix.kind.nil?
          %tr
            %th
              Symmetric
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:symmetric)}
                %span.fas.fa-question-circle
            %td= @matrix.structure == "symmetric" ? "Yes" : "No"
          %tr
            %th
              Date
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:date)}
                %span.fas.fa-question-circle
            %td= @matrix.date
          %tr
            %th
              Author
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:author)}
                %span.fas.fa-question-circle
            %td= @matrix.author
          %tr
            %th
              Editor
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:editor)}
                %span.fas.fa-question-circle
            %td= @matrix.editor
    .col-md-6.col-md-push-6
      #figures.carousel.carousel-dark.slide{'data-bs-ride': "carousel"}
        .carousel-indicators
          - fig_num = -1;
          -for image in image_list(@matrix) do
            %button.btn{type: 'button', 'data-bs-target': "#figures", 'data-bs-slide-to': "#{fig_num += 1}", class: ("active" if image[:first])}
        .carousel-inner
          -for image in image_list(@matrix) do
            .carousel-item{class: ("active" if image[:first])}
              = link_to image[:url] do
                = image_tag image[:url], class: "img-fluid d-block w-100", alt: image[:description]
        %button.carousel-control-prev{type: 'button', 'data-bs-target': "#figures", 'data-bs-slide': 'prev'}
          %span.carousel-control-prev-icon{'aria-hidden': 'true'}
          %span.sr-only
            Previous
        %button.carousel-control-next{type: 'button', 'data-bs-target': "#figures", 'data-bs-slide': 'next'}
          %span.carousel-control-next-icon{'aria-hidden': 'true'}
          %span.sr-only
            Next

  .row
    .col-md-6
      %table.table.table-striped
        %tbody
          %tr
            %th Structural Rank
            %td= number_with_delimiter(@matrix.structural_rank, delimiter: ',')
          %tr
            %th Structural Rank Full
            %td= @matrix.structural_full_rank
          %tr
            %th
              Num Dmperm Blocks
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:num_dmperm_blocks)}
                %span.fas.fa-question-circle
            %td= number_with_delimiter(@matrix.num_dmperm_blocks, delimiter: ',')
          %tr
            %th
              Strongly Connect Components
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:num_strongly_connected_components)}
                %span.fas.fa-question-circle
            %td= number_with_delimiter(@matrix.num_strongly_connected_components, delimiter: ',')
          %tr
            %th
              Num Explicit Zeros
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:num_explicit_zeros)}
                %span.fas.fa-question-circle
            %td= number_with_delimiter(@matrix.num_explicit_zeros, delimiter: ',')
          %tr
            %th
              Pattern Symmetry
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:pattern_symmetry)}
                %span.fas.fa-question-circle
            %td= number_to_percentage(@matrix.pattern_symmetry ? @matrix.pattern_symmetry*100 : nil, options={precision:1, strip_insignificant_zeros:true})
          %tr
            %th
              Numeric Symmetry
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:numeric_symmetry)}
                %span.fas.fa-question-circle
            %td= number_to_percentage(@matrix.numeric_symmetry ? @matrix.numeric_symmetry*100 : nil, options={precision:1, strip_insignificant_zeros:true})
          %tr
            %th
              Cholesky Candidate
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:cholesky_candidate)}
                %span.fas.fa-question-circle
            %td= @matrix.cholesky_candidate
          %tr
            %th
              Positive Definite
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:positive_definite)}
                %span.fas.fa-question-circle
            %td= @matrix.positive_definite
          %tr
            %th
              Type
              %a.small{href: '/statistics', 'data-bs-toggle': 'tooltip', title: tooltip_text(:rb_type)}
                %span.fas.fa-question-circle
            %td{colspan: 2}= @matrix.rb_type
    - if @matrix.norm
      .col-md-6
        %table.table.table-striped
          %tbody
            %tr
              %th{colspan:2, style: 'text-align: center'} SVD Statistics
            %tr
              %th Matrix Norm
              %td= number_with_delimiter(@matrix.norm, delimiter: ',')
            %tr
              %th Minimum Singular Value
              %td= number_with_delimiter(@matrix.min_singular_value, delimiter: ',')
            %tr
              %th Condition Number
              %td
                -if @matrix.condition_number.to_i < 1E9
                  = number_with_delimiter(@matrix.condition_number, delimiter: ',')
                -else
                  = "%e" %@matrix.condition_number
            %tr
              %th Rank
              %td= number_with_delimiter(@matrix.svd_rank, delimiter: ',')
            %tr
              %th sprank(A)-rank(A)
              %td= number_with_delimiter(@matrix.sprank_minus_rank, delimiter: ',')
            %tr
              %th Null Space Dimension
              %td= number_with_delimiter(@matrix.null_space_dimension, delimiter: ',')
            %tr
              %th Full Numerical Rank?
              %td= @matrix.full_numerical_rank
            %tr
              %th Download Singular Values
              %td
                = link_to @matrix.get_url(:svd), {class: 'btn btn-outline-dark btn-sm'} do
                  MATLAB
                  %span.fa.fa-download{'aria-hidden':'true'}
  .row
    .col-md-12
      %table.table.table-striped
        %tbody
          %tr
            %th Download
            %td
              = link_to @matrix.get_url(:matlab), {class: 'btn btn-outline-dark btn-sm'} do
                MATLAB
                %span.fa.fa-download{'aria-hidden':'true'}
              = link_to @matrix.get_url(:rutherford_boeing), {class: 'btn btn-outline-dark btn-sm'} do
                Rutherford Boeing
                %span.fa.fa-download{'aria-hidden':'true'}
              = link_to @matrix.get_url(:matrix_market), {class: 'btn btn-outline-dark btn-sm'} do
                Matrix Market
                %span.fa.fa-download{'aria-hidden':'true'}
          %tr
            %th Notes
            %td
              - if @matrix.notes
                .notesbox
                  %pre.pre-scrollable= @matrix.notes
:javascript
  $(document).ready(function(){
    //$('[data-bs-toggle="tooltip"]').tooltip();
    const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
    const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
  });