Coder Social home page Coder Social logo

hierarchicalmatrices.jl's Introduction

HierarchicalMatrices.jl

Build Status AppVeyor

This package provides a flexible framework for hierarchical data types in Julia.

Create your own hierarchical matrix as simply as:

julia> using HierarchicalMatrices

julia> @hierarchical MyHierarchicalMatrix LowRankMatrix Matrix

The invocation of the @hierarchical macro creates an abstract supertype AbstractMyHierarchicalMatrix{T} <: AbstractMatrix{T} and the immutable type MyHierarchicalMatrix, endowing it with fields of HierarchicalMatrixblocks, LowRankMatrixblocks, Matrixblocks, and a matrix of integers, assigned, to determine which type of block is active. The package comes pre-loaded with a HierarchicalMatrix.

See the example on speeding up the matrix-vector product with Cauchy matrices.

Implementation

A straightforward implementation of hierarchical (self-referential) data types might suffer from Russell's paradox. In the context of types, Russell's paradox states that either you know the type, or you know its fields, but neither concretely. On one side of the paradox, you end up with type-stable constructors and type-unstable getters; on the other side, you are stuck with type-unstable constructors and type-stable getters.

This implementation of hierarchical data types avoids Russell's paradox at the cost of restricting the entire list of concrete matrix types that are the fields upon construction. This allows for fast and type-stable setters and getters. Enjoy!

hierarchicalmatrices.jl's People

Contributors

dlfivefifty avatar mikaelslevinsky avatar tkelman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hierarchicalmatrices.jl's Issues

KernelMatrix goes into infinite loop

using LinearAlgebra
using HierarchicalMatrices

h = 0.05
L = 5.0
N = Int(floor(L/h))
xs = range(-L,L,length=N)

K(x,y) = 1/(1+abs(x-y))


KM = KernelMatrix(K,Array(xs),Array(xs),-L,L,-L,L)

goes into an infinite loop. h=0.1 works.

How best to use shared memory parallelism in Julia?

A ccall acts as a thread barrier, so even if it's calling BLAS which is multithreaded, the overhead might be high for exceptionally low-rank data structures. Perhaps there's a better way to thread from the top down.

Different name for partial-update functions?

The signatures of A_mul_B! and scale! and similar here that take start indices that don't match the signatures used by those functions in base don't really need to use the same name here, do they? It might be clearer to distinguish them by more than just the number of inputs, since Base is never going to lower to or call these signatures.

norm(matrix) -> opnorm(matrix) in Julia 0.7

It looks like may be using norm(matrix). In Julia 0.7, this will compute the Frobenius norm (vecnorm in Julia 0.6), due to JuliaLang/julia#27401. If you want the induced/operator norm as in Julia 0.6, use opnorm(matrix) instead, or Compat.opnorm(matrix) to work in 0.6 and 0.7 (JuliaLang/Compat.jl#577).

Note that, for testing purposes, rather than @test norm(A - B) ≤ tol, it is usually preferred to do @test A ≈ B or @test A ≈ B rtol=... (which uses isapprox).

2D with reshaped array

Really nice work! I am wondering if this is also suitable for the convolution of a 2D field? Do you require the indices of x be related to the physical position it represents? Thanks!

Ke

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.