question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

construct evaluation matrix

See original GitHub issue

Given a domain and a number of points within this domain, I would like to construct the small and fat evaluation matrix E which, given coefficient vector x returns E @ x, the values of the corresponding finite element function at the points. In FEniCS, I could do

  def _build_eval_matrix(V, points):
      """Build the sparse m-by-n matrix that maps a coefficient set for a
      function in V to the values of that function at m given points.
      """
      mesh = V.mesh()

      bbt = BoundingBoxTree()
      bbt.build(mesh)
      dofmap = V.dofmap()
      el = V.element()
      sdim = el.space_dimension()

      rows = []
      cols = []
      data = []
      for i, x in enumerate(points):
          cell_id = bbt.compute_first_entity_collision(Point(*x))
          cell = Cell(mesh, cell_id)
          coordinate_dofs = cell.get_vertex_coordinates()

          rows.append(numpy.full(sdim, i))
          cols.append(dofmap.cell_dofs(cell_id))

          v = el.evaluate_basis_all(x, coordinate_dofs, cell_id)
          data.append(v)

      rows = numpy.concatenate(rows)
      cols = numpy.concatenate(cols)
      data = numpy.concatenate(data)

      m = len(points)
      n = V.dim()
      matrix = sparse.csr_matrix((data, (rows, cols)), shape=(m, n))
      return matrix

The explicit loop doesn’t hurt much since the number of points is usually small.

Any hints?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
kinnalacommented, Apr 1, 2021

Yeah, probes was unreleased so we decided to use this approach.

0reactions
kinnalacommented, Apr 1, 2021

Alright, next release will be 3.0.0. I was expecting to further test and document some new features but we can always go for 3.0.x if any issues arise. I need to go through the issues and the changelog one more time and see if we are able to tag 3.0.0 in two weeks or so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Putting Together an Evaluation Matrix | CDC
While a matrix provides a 100ft view of your evaluation process, the analysis plan provides a 10ft view and can help make sure...
Read more >
Evaluation Matrix Example - AWS
Using an Evalua on Matrix helps to ensure that Engineers make decisions based upon evidence - or, the quan ta ve values that...
Read more >
How BAs Can Use a Decision Matrix to Make Tough Choices
A decision matrix is a tool that helps business analysts and other stakeholders evaluate their options with greater clarity and objectivity. A decision...
Read more >
Evaluation Matrix - an overview | ScienceDirect Topics
An evaluation matrix was made, crossing, on the one hand, the type of users (main target user of the evaluated application or object)...
Read more >
What is a Decision Matrix? Pugh, Problem, or Selection Grid
Decision Matrix Procedure · Brainstorm the evaluation criteria appropriate to the situation. If possible, involve customers in this process. · Discuss and refine ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found