instruction
stringlengths
0
29.8k
⌀
As the recurrence only involves values four units apart, we rewrite with $n=4m$: $$T(4m)=T(4m-4)+(4m)^2$$ or $$U(m)=U(m-1)+16m^2.$$ The solution is $$U(m)=U(0)+16\sum_{k=1}^mk^2= U(0)+16\frac{m(m+1)(2m+1)}6$$ by the well-known formula for the sum of squares. From this $$T(n)=T(0)+\frac{n(n+2)(n+4)}{12...
Standard Cholesky requires square roots, which will break the integral property. The method you are after is probably LDL decomposition. https://en.wikipedia.org/wiki/Cholesky_decomposition#LDL_decomposition
If I am reading this right, you are saying that Java implements HashSet using HashMap, with NULL values, and are asking why you couldn't implement HashMap using (an alternate implementation of) HashSet? If this is the case, then consider: This alternate implementation of HashSet would most likely NOT store the hashe...
I need to generate maze with 100x100 rooms. Each room connected only with 1 other room. Here are example of correct 2x2 mazes: ``` +-+-+ |...| +-+.+ |...| +-+-+ ``` And here are some incorrect 2x2 mazes: ``` +-+-+ +-+-+ +...+ |.|.| +.+.+ +-+.+ +...+ |...| +-+-+ +-+-+ ``` For scoring ou...
Algorithm to maximize generated maze score
|graphs|discrete-mathematics|linear-programming|maze|
I need to generate maze with 100x100 rooms. Each room connected only with 1 other room. Here are example of correct 2x2 mazes: ``` +-+-+ |...| +-+.+ |...| +-+-+ ``` And here are some incorrect 2x2 mazes: ``` +-+-+ +-+-+ +...+ |.|.| +.+.+ +-+.+ +...+ |...| +-+-+ +-+-+ ``` For scoring ou...
I need to generate maze with 100x100 rooms. Each room connected only with 1 other room. Here are example of correct 2x2 mazes: ``` +-+-+ |...| +-+.+ |...| +-+-+ ``` And here are some incorrect 2x2 mazes: ``` +-+-+ +-+-+ +...+ |.|.| +.+.+ +-+.+ +...+ |...| +-+-+ +-+-+ ``` For scoring ou...
I have an upper row of $N$ equally spaced 'units' and a lower row of $N$ equally spaced 'units'. I would like to connect any of the upper row of units to the lower units via orthogonal connectors (consisting of horizonal and vertical line segments) such that although a horizontal and a vertical line segment, e.g. conne...
Orthogonal connectors with non-overlapping horizontal or vertical line segments
|algorithms|computational-geometry|
I have an upper row of $N$ equally spaced 'units' and a lower row of $N$ equally spaced 'units'. I would like to connect any of the upper row of units to the lower units via orthogonal connectors (consisting of horizonal and vertical line segments) such that although a horizontal and a vertical line segment, e.g. conne...
I have an upper row of $N$ equally spaced 'units' and a lower row of $N$ equally spaced 'units'. I would like to connect any of the upper row of units to the lower units via orthogonal connectors (consisting of horizonal and vertical line segments) such that although a horizontal and a vertical line segment, e.g. conne...
I have an upper row of $N$ equally spaced 'units' and a lower row of $N$ equally spaced 'units'. I would like to connect any of the upper row of units to the lower units via orthogonal connectors (consisting of horizonal and vertical line segments) such that although a horizontal and a vertical line segment, e.g. conne...
Let the upper row units be denoted by $u_1, \dotsc, u_N$ and lower row units be denoted by $\ell_1, \dotsc, \ell_N$. You can divide the region between the upper and lower rows into a grid $G$ of size $N \times N$. For connecting $u_i$ to $\ell_j$ simply choose the path $G[1,i]$ -> $G[i,i]$ -> $G[i,j]$ -> $G[N,j]$ (...
I have an upper row of $N$ equally spaced 'units' and a lower row of $N$ equally spaced 'units'. I would like to connect any of the upper row of units to the lower units via orthogonal connectors (consisting of horizonal and vertical line segments) such that although a horizontal and a vertical line segment, e.g. conne...
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}],"DeleteType":1}
The article says it. They focused on short sequences of $3$ to $5$ elements using the sorting network technique. They say they achieved $70\%$ speedup on these cases. But when you look closely to the detailed benchmarks, you see that $70\%$ is a unique extreme case, and speedups are more commonly like $+30\%$, $0\%$ an...
A key benefit of virtual memory (besides simulation of more RAM than truly available) is that *every process* sees the *whole address space* available to itself. This greatly simplifies memory mapping for the applications. Together with processor time sharing, every process gets an own, private and huge computer.
I have an upper row of $N$ equally spaced 'units' and a lower row of $N$ equally spaced 'units'. I would like to connect any of the upper row of units to the lower units via orthogonal connectors (consisting of horizonal and vertical line segments) such that although a horizontal and a vertical line segment, e.g. conne...
Let the upper row units be denoted by $u_1, \dotsc, u_N$ and lower row units be denoted by $\ell_1, \dotsc, \ell_N$. You can divide the region between the upper and lower rows into a grid $G$ of size $2N \times 2N$. For connecting $u_i$ to $\ell_j$ simply choose the path $G[1,2i]$ -> $G[2i,2i]$ -> $G[2i,2j-1]$ -> $...
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}]}
null
The improvement in the figure consists of the removal of one instruction. In a branch-less assembly program, this usually leads to a performance improvement. How much of a practical improvement it would be depends on how the subroutine is used. Of course, the program should still be correct after this modification....
Let the upper row units be denoted by $u_1, \dotsc, u_N$ and lower row units be denoted by $\ell_1, \dotsc, \ell_N$. You can divide the region between the upper and lower rows into a grid $G$ of size $2N \times 2N$. For connecting $u_i$ to $\ell_j$ simply choose the path $G[1,2i]$ -> $G[2i,2i]$ -> $G[2i,2j-1]$ -> $...
> How can an embedded multi-core systems implement protection if there is no VM? ARM Cortex M0+ with an MPU, as found in RP2040 for example (embedded multi-core controller), uses a limited number (namely 8) of configurable memory regions. Start, size, and protection bits can be set per region, and regions can overla...
null
I've just hashed up the following hair-brained idea of how to sort n-tuples of integers, as demonstrated below with a set of 3-tuples: [ 4 , 1 , 3 ] [ 1 , 2 , 1 ] [ 2 , 2 , 1 ] [ 2 , 1 , 1 ] [ 1 , 1 , 1 ] [ 2 , 1 , 2 ] [ 3 , 1 , 3 ] [ 1 , 2 , 2 ] [ 1 , 1 , 3 ] [ 1 , 1 , 2 ] [ 3 , 1 , 1 ] [ 3 ,...
Why does Java's `HashSet` have an underlying `HashMap`, not the other way around? `HashMap` could have contained an internal `HashSet` of `Map.Entry`s, and `HashSet` wouldn't have stored a reference to an internal "dummy" `Object` per each element (while implementing the hashtable data structure itself). Is there (coul...
My goal is to solve the above-constrained minimization problem where my vector to be optimized is `x`. The matrix `A` and the vector `y` are known to me. There are a lot of non-PyTorch libraries like CVXPY and scipy.minimize that do it, but they are very slow when the matrices become large and I am going to run this al...
Solving constrained optimization problem using PyTorch: Minimizing L1 norm of $\vec{x}$ subject to $\vec{x} = \mathbb{A^{-1}}\vec{y}$
|algorithms|optimization|machine-learning|constraint-programming|
The "input-encoding problem" is where the binary representations of symbolic input variables to a Boolean function are chosen to minimize the decode logic complexity. The "Espresso-MV" software can be used to do this, [here's][1] one of the most cited papers on the topic by the developer, from the mid-late 80s. The ...
Solving the constraint portion of the "input-encoding" problem
|optimization|constraint-satisfaction|applied-theory|boolean-complexity|
null
Instead of starting with the properties of $\mathrm{Y}$, start with a term that explicitly refers to itself: $$\textbf{letrec }f = \ldots f \ldots f \ldots \textbf{ in } f$$ and consider how it could be expressed without $\textbf{letrec}$. You can get an equivalent term by passing $f$ as an argument to itself ...
null
Instead of starting with the properties of $\mathrm{Y}$, start with a term that explicitly refers to itself: $$\textbf{letrec }f = \ldots f \ldots f \ldots \textbf{ in } f$$ and consider how it could be expressed without $\textbf{letrec}$. You can get an equivalent term by passing $f$ as an argument to itself ...
null
There are a lot more use cases for virtual memory. On top of address space separation as Yves pointed out, there are a bunch of others, for example: - Sharing memory between processes. This is much more common than you think, since it's how running multiple copies of an executable, or shared libraries, are often ha...
Solving the constraint portion of the input-encoding problem
Recently, I’ve been interested in the console of the Source game engine, more specifically, its `alias` command, which allows one command to invoke others. It may allow recursion (i.e. running `alias freeze freeze` will cause inputting `freeze` to freeze the engine), but does not allow parameters (i.e. running "`alias ...
null
There are multiple notions of "reduction." You've correctly described a **many-one reduction** of $HALT$ to $A_{TM}$. The reduction you've linked to (with the proof on [slide 24][0] of the [deck you linked][1]) is instead a **truth-table reduction**. These are more general objects (so your result is stronger). Each is ...
null
a*(ac* + bc* + cc* + b*bc* + b*cc* ) + b*(bc* + cc*) + c* = (a*a + a*b + a*c + a*b*b + a*b*c + b*b + b*c + ϵ)c* = (a*a + a*b*b + a*b*c + ϵ)c* = a*(a + b*b + b*c + ϵ)c*
I am working on an NP-Complete problem, i.e., the dominating set. Given a graph $G = (V, E)$, a set $S$ is a dominating set if every vertex $v \in V \setminus S$ has at least one neighbor in $S$. I am looking for the complexity of the problem in trees. I have tried the greedy method to solve this problem. But, looks li...
Minimum dominating set on trees
|graphs|np-hard|polynomial-time|
The Pledge algorithm requires you to be able to recognize the entrance whenever you stumble upon it and treat it as a wall. In essence, it is as if you initially walked into the maze and closed the entrance door behind you, immediately putting yourself at an interior point in the maze—the scenario that the Pledge al...
The problem is solvable in linear time by dynamic programming. Root a the input tree $T$ in an arbitrary vertex and let $T_v$ be the subtree of $T$ rooted in v. Let $OPT[v]$ denote the size of a minimum dominating set of $T_v$. Let $OPT^-[v]$ denote the minimum size of a subset of vertices of $T_v$ that dominate...
The problem is solvable in linear time by dynamic programming. Root a the input tree $T$ in an arbitrary vertex and let $T_v$ be the subtree of $T$ rooted in v. Let $OPT[v]$ denote the size of a minimum dominating set of $T_v$. Let $OPT^-[v]$ denote the minimum size of a subset of vertices of $T_v$ that dominate...
Suppose we have a grid of points (which can also be very dense 10000x10000) like the one in the figure in which the points are marked with two different colors. [![enter image description here][1]][1] What is the best algorithm from a performance point of view that allows me to reconstruct the outline of the red d...
Detect contour from point grid
|square-grid|
I am studying for an MSc in AI and I am currently thinking about attending a bootcamp on a computer science subject. The motive is that I want to gain hands on experince on practical applications and the MSc course may be a bit too "academic". The question is: which subjects combine well with an MSc in AI. For ex...
Combining study in AI with other Computer Science fields
|career|
[Marching squares][1] might be the simplest. Imagine that the red points are samples with value -1 and the blue points are samples with value 1, then look for a line with value 0. This algorithm is optimal, in that you have to visit each cell at least once, and this visits each cell once. Just for completeness, i...
I have read the GPT-1 paper, and my understanding is that it works as follows: $U$ is input tokens, $h_0=UW_e+W_p$, $h_i=\text{transformer_block}(h_{i-1})$ and the output is a probability vector $P(u)=\text{softmax}(h_nW_e^T)$, and the hidden states are the final latent layer before softmax, so the hidden states are $h...
null
I'm learning LTL (linear temporal logic) and we learned that a model $M$ and a starting position $q_0$ satisfies a LTL formula $\psi$ iff for every path $\pi$ starting at $q_0$ it is true that $\pi \models \psi$. I also learned that the Next ($X$) operator is dual to its negation meaning $X \neg p = \neg Xp$. This c...
About next operator duality in LTL
|linear-temporal-logic|
A denotational semantic for the lambda calculus can be given by solving the domain equation $$ D \simeq [D →_c D]_\bot $$ in the category of $\omega$-complete CPOs, where $→_c$ denotes the space of $\omega$-continuous functions. The existence of an (initial) solution to this domain equation is a classic result by...
Can `D = (D→ D)_⊥` be solved in the domain of DCPOs with monotonic functions?
|order-theory|denotational-semantics|
ok apparently $\overline{IS}$ is also $NPComplete$ which means $A \in NP$ and we already know from the reduction that $A\in \text{NP-Hard}$ which mean $A\in NPComplete$ we also know that $\overline{A}\in NP$ $→A\in NPComplete \land A\in coNP → NP=coNP →$ NP is closed under complement
A denotational semantic for the lambda calculus can be given by solving the domain equation $$ D \simeq [D →_c D]_\bot $$ in the category of $\omega$-complete CPOs, where $→_c$ denotes the space of $\omega$-continuous functions. The existence of an (initial) solution to this domain equation is a classic result by...
null
The problem is solvable in linear time by dynamic programming. Root a the input tree $T$ in an arbitrary vertex and let $T_v$ be the subtree of $T$ rooted in v. Let $OPT[v]$ denote the size of a minimum dominating set of $T_v$. Let $OPT^-[v]$ denote the minimum size of a subset of vertices of $T_v$ that dominate...
A denotational semantic for the lambda calculus can be given by solving the domain equation $$ D \simeq [D →_c D]_\bot $$ in the category of $\omega$-complete CPOs, where $→_c$ denotes the space of $\omega$-continuous functions. The existence of an (initial) solution to this domain equation is a classic result by...
For the past two days I have been on a question to understand monads in the context of Haskell. A nice explanation I found is by Graham Hutton on the Computerphile channel [see here](https://www.youtube.com/watch?v=t1e8gqXLbsU&pp=ygUGbW9uYWRz). This explanation has also been paraphrased into [this nice answer on stacko...
Mathematical explanation of the usage of monads to wrap data for avoiding errors
|haskell|monad|
OpenAI's [technical paper on GPT-3](https://arxiv.org/abs/2005.14165) says that GPT-3 has 175 billion parameters. Several sites ([here](https://blog.inten.to/gpt-3-language-models-are-few-shot-learners-a13d1ae8b1f9), [here](https://www.hyro.ai/glossary/gpt-3/)) claim that these parameters are stored as single-precision...
At what precision are GPT's parameters stored?
|artificial-intelligence|neural-networks|memory-hardware|
>Are there any references on theoretical computer science aimed at people with a background in research mathematics? For reference, I spend my time thinking about category theory and set theory most days. I've begun programming in haskell and it feels very intuitive now that I'm starting to get the whole 'type' synt...
Introduction to theoretical computer science for research mathematicians
|reference-request|
null
null
null
I have some troubles in understanding of the Brzozowski's algorithm for NFA to minimized DFA transformation. Or maybe I'm doing a mistake in the NFA to DFA transformation steps. The Algorithm, as described in [Wikipedia](https://en.wikipedia.org/wiki/DFA_minimization#Brzozowski's_algorithm), is as follows: 1. Rever...
[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/k3dQr.png **( Source: Introduction to the theory of computation, Michael Sipser, 3rd edition )** I know the computation-time of a non-deterministic Turing machine ( NTM ) which is a decider is defined to be the depth of its configur...
Why nondeterministic decider for $ HAMPATH $ runs in polynomial time?
|turing-machines|nondeterminism|
As per the rules of JS, `Arrow` functions don't have an *argument Object*, like a regular function inside JS. But it is also true, that we can pass arguments to the `Arrow` functions like any other functions. What is the data structure at play here, if not an argument object, then how does an `Arrow` functions refer...
Data structure for arguments in Arrow functions in JS
|data-structures|memory-allocation|generating-functions|
null
I would like to understand better how associative memory works.In associative memory we have the tag and the actual data being stored.The tag describes where the data came from but what does this mean exactly?
Associative memory addressing
|memory-management|cpu-cache|
null
The problem is solvable in linear time by dynamic programming. Root a the input tree $T$ in an arbitrary vertex and let $T_v$ be the subtree of $T$ rooted in v. Let $OPT[v]$ denote the size of a minimum dominating set of $T_v$. Let $OPT^-[v]$ denote the minimum size of a subset of vertices of $T_v$ that dominate...
A $k$-regular graph is one in which every vertex has degree *k*. A *triangle-free* graph is one in which any three vertices do not form a triangle. A dominating set $D$ of a graph $G$ is a set of vertices such that $\forall v \in (V(G)\setminus D)$, $v$ has a neighbour in $D$. Is anything known about the hardness of...
On hardness of finding dominating sets in triangle-free regular graphs