Tuple projections in OCaml interface for Z3 - ocaml

I am trying to create formulas in which I reference specific elements of a tuple in the OCaml Interface for Z3. Is there some way to express the projection of a tuple in the interface?
In general, I have been trying to find more resources on the OCaml interface but have only found this:
https://z3prover.github.io/api/html/ml/index.html,
which contains minimal descriptions, and this example:
https://github.com/Z3Prover/z3/blob/master/examples/ml/ml_example.ml
Are there any other resources/examples that can assist me with the interface?
Thanks for any help!

Related

Generating Data Matrix in Clojure

I have a collection that consists of binary sequences.
I want to generate a Data Matrix based on that collection. Are there any libraries in Clojure that facilitate Data Matrix generation?
Edit: Like this.
I don't know of any specific library but you could easily implement this in Quil?
Here is an example of the Game of Life in Quil that's very similar to what you are looking for.

Visual trace of sorting algorithms using a graph in C++?

I am in an Intro to data structures class and we are currently going over sorting algorithms. Is there any way in C++ to use a graph to trace the exchanging and sorting of sorting algorithms? There is an image illustrating shell sort if you follow this link and scroll down a bit. I also linked it down below. (Essentially what I would like to achieve). Addison Wesley, Algorithms 4th edition: http://algs4.cs.princeton.edu/21elementary/.
They spoke about using built in functions in Java to create the graph and spoke about it as if it is rather trivial. I'm assuming if its basic in Java its basic in C++.
Question being, how would I implement a function that would correspond numerically to how big the bars are and output the graph pre-sort, mid-sort and post-sort?
Note: I have intermediate level C++ knowledge and no experience with graphics.
Consider using a graphing package such as gnuplot. You would have to use it to plot, say as bar graphs, the array values your program is trying to sort.

Which linear algebra to use for OpenGL in Haskell?

I am trying to do some OpenGL programming in haskell. But i am confused by the current state of the libraries. OpenGL uses the Tensor package which only defines several vector types (but doesn't do so in a generic way). It doesn't seem to provide any Matrix implementations.
There are several other packages for linear algebra: tensor (note the lowercase T), Vec, hmatrix which seem to be more complete than Tensor.
What i am searching for should at least contain common functions used in 3d and 2d graphics, have reasonable performance and should be compatible with OpenGL but i guess i'll have to change the library for that.
Late answer, sorry. HMatrix is the standard choice for things like this. It's very compatible, has a nice API, and is actually used for computer vision among other applications: http://dis.um.es/profesores/alberto/research.html
I was wondering the same recently, and was especially annoyed that Tensor doesn't provide you with convenient functions for dot product, cross product, normalization etc.
As you pointed out, vect is "hardcoded" for Float and Double, and therfore cannot have useful typeclass instances like Functor, Monoid or Applicative - with those we would get a lot of operations "for free", e.g. addition: (+) <$> v1 <*> v2.
On #haskell, I was pointed to the linear package. It is well-maintained and comes with a bunch of useful instances and functions.

How to create a named_graph with Boost Graph Library?

I am currenty working with the Boost Graph Library. I need unique edges and vertices. Unfortunately the boost graphes doesn't provide this feature. So I have to check manual every time before I am inserting an edge or a vertex.
Now I've found this: http://www.boost.org/doc/libs/1_49_0/boost/graph/named_graph.hpp
I am wondering if this would help me? Because the documentation says no word about named_graph I don't know how to use it. Maybe there is someone around who could give me a little example or explenation? This would help me a lot.
Thanks in advance.
The Boost Graph Library is very flexible and allows you to choose the internal representation for your vertices and edges. If you choose a container such as std::set then you could enforce unique vertices and edges directly. Details are here: Using Adjacency List
The named_graph type allows you to index your vertices by a property you can choose yourself (for example a "string" representing a name). It effectively wraps a standard adjacency_list in a map whose key is the named property and whose values are the nodes. There is a good example of how to use it in the boost source named_vertices_test.cpp.
Not sure what you're trying to do, but you could use a std::map/std::set yourself to map from some unique property to nodes in an adjacency_list. If you just need to ensure the graph has unique nodes/edges when you make it, then this approach is straightforward and simple, and is usually the best way.
You should think about the consequences of changing the backed containers to std::set- for example the performance of many algorithms will change. There is no simple answer to which is the best container to use.

Implementing a discrete Markov Chain simulation in c++ with a graphical interface

I just wanted to know if any one had any pointers for a library or libraries that support Markov modelling and graphical graph representation, as for a project i must simulate a transport model and be able to develop an interface for it too. I am relatively new to c++.
Have a look at Boost Graph as it will simplify all your graph work. I am unsure if there is a Markov Chain algiorithm (I am looking for one too) but it should be easy to write once you have the graph -- a concurrent monte carlo approach maybe?
Numerical Recipes has many algorithm and code in both C and C++.
The graphviz tools are all you need to draw graphs.