probability theory – Linear transformations making independent features dependent

I read about features and some relevant topics recently. I ran into an easy but very advanced question:

Why can two independent features become dependent after applying a linear transformation?

I think this is false, because:

For $x_1$ and $x_2$, after linear transformation $y_1=ax_1+b$ and $y_2=cx_2+d$, $y_1$ and $y_2$ are independent.

schema – Making similar points close in distance O(n) query by distance

I’m trying to create a database in DynamoDB that has many points with high dimensions. For the most part, I have designed the database to the regular access patterns. However, for a search endpoint, I quickly realized that my points need to be close by similarity.

Initially I thought it would be ok for me to use an index that represented a vector. For instance if there is a cat and no dog and a frog in picture 1 the vector would be 101

But in order to get a list of pictures with cats I would have to query for 1XX, where X is a wildcard. In this case it seems fine as there are only 3 dimensions so it would be O(1)

but with a high dimension it quickly becomes a limiting factor as we would have to query m number of dimensions O(m). I get that each of these points are on a different partition so each m dimensions can be queried at the same time. However, this solution is still not acceptable given the future usage.

Is there a way to define the distance function when using the sort index in DynamoDB or a more clever way of defining the feature vector in such a way that the points would be sorted by distance?

How can a GM subtly guide characters into making campaign-specific character choices?

Note: the example I’m giving is D&D focussed, but the question is system-agnostic.

We’re in the early days of a new D&D group. If it keeps running, I’m planning to transition the players into Storm King’s Thunder once they reach 5th level. Storm King’s Thunder is an adventure that features a lot of giants.

I allowed the party to defer some character creation choices so we could get playing faster, and one of them has an unused language slot. The party also has a Ranger and the revised version of the class can, at higher levels, choose an epic foe against whom they get combat bonuses.

It would be very sensible if that unused language could turn out to be giantish and that the ranger could take giants as their epic foe. It would also be nice if I didn’t have to lay out to the players that there are giants in store later – they’re all new, and they won’t guess.

Are there any good story-driven ways that a GM can help "guide" players toward making character creation choices that fit the planned campaign?

c++ – Making std::optional a monad via SFINAE

To practice with SFINAE, template meta programming, functional programming and monads in C++, I decided to try writing a skinny version of the two functions (monadic binding and return) that make std::optional a monad.

Here’s the result:

#include <optional>
#include <utility>
#include <vector>

template<typename T, typename TD = std::decay_t<T>, typename = void>
struct is_optional : std::false_type {};

template<typename T, typename TD>
struct is_optional<
    std::enable_if_t<std::is_same_v<TD,std::optional<typename TD::value_type>>>
    > : std::true_type {};

template<typename T>
inline constexpr bool is_optional_v = is_optional<T>::value;

template<typename T, typename F, typename = void>
struct MBind {
    inline constexpr auto operator()(T&&, F&&) const noexcept = delete;

template<typename T, typename F>
struct MBind<T, F, std::enable_if_t<
    is_optional_v<T> && is_optional_v<decltype(std::declval<F>()(std::declval<T>().value()))>
    >> {
    template<typename Opt = T, typename Fun = F>
    inline constexpr auto operator()(Opt&& opt, Fun&& f) const noexcept {
        return opt ? f(*std::forward<T>(opt)) : decltype(f(*std::forward<T>(opt))){};

inline constexpr auto mbind = ()(auto&& t, auto&& f) noexcept {
    return MBind<decltype(t), decltype(f)>{}(

inline constexpr auto mreturn = ()(auto&& x){
    return std::make_optional(std::forward<decltype(x)>(x));

int main()
    auto xxx1 = mbind(std::optional<int>{1}, ()(auto){ return mreturn(3.3); }); // Ok
    //auto xxx2 = mbind(std::optional<int>{1}, ()(auto){ return 1; });          // wrong F
    //auto xxx3 = mbind(std::vector<int>{1,2}, ()(auto){ return mreturn(3); }); // wrong T

A few points on which I’d like to receive some feedback, beside any other comments that the code above needs.

  • I know I’ve written a meta-function is_optional_v which doesn’t really enforce that T satisfies the general concept of a maybe, but requires that it is exactly a std::optional; my target was not to learn writing concepts (yet).
  • For invalid types I’ve deleted the operator() that actually does the binding, so I have no place to put any message like "this is not a `std::optional`, man"; the same hold also for the metafunction is_optional_v; actually, probably the latter, not MBind::operator(), should be responsible for issueing a compiler message about the input being not a std::optional, whereas MBind::operator() should probably be responsible for complaining about the monadic function passed in.
  • I have tried to perfect forwarding things whenever it makes sense, but I’m not really sure I’ve done it the right way.
  • I have templated MBind and not (just) its operator() to allow me partial specialization so that I could use the SFINAE-std::enable_if idiom.
  • I have defaulted the template parameters of operator() to those of the class, because (as explained above) I didn’t want to make everything that behaves like an optional a monad; I think I would do that via tag dispatching when I get more comfortable with this stuff.
  • Have I exagerated with inline and constexpr? Or, is any of those superfluous or inherently a bad idea?

algorithm – Making code faster. BITWISE OR operator

Given an array A of N integers, you will be asked Q queries. Each query consists of two integers L and R. For each query, find whether bitwise OR of all the array elements between indices L and R is even or odd.

My approach:
Accept the array of N integers. For any query (Qi) scan the array of integers between the given limit. If an odd number is found (x%2==1) then raise a flag and terminate scanning. If flag is found raised tell that the result is odd, else say that it’s even.

On thinking further, I find myself at the dead end. I can’t optimize the code anymore. Only thing I can think of is instead of doing mod 2 I will check the last digit of each number and see if it is one of (0,2,4,6,8). Upon trying that, the time limit still expired (in context to competitive programming (1); Note: the competition has ended a day ago and results declared). Anyways, my question is to find a better method if it exists or optimize the code below.

I assume that the time complexity is O(nQ) where n is the number of elements in the given range.

Assume array is 1-indexed.
First line consists of two space-separated integers N and Q.
Next line consists of N space-separated array elements.
Next Q lines consist of two space-sepaprated integers L and R in each line.

#pragma GCC optimize("O2") 

int main()
    long int c,d,j,N,Q;
    int fagvar=0;
    scanf("%ld %ldn",&N,&Q);
    int a(N);
    int i=0;
        scanf("%ld %ld",&c,&d);
            if (a(j)%2==1)
        if (fagvar==1)
    return 0;

modding – Making mods for Game Pass/Microsoft Store Starbound

I want to make mods for the Game Pass/Microsoft Store version of Starbound. I know it is possible to install mods for this version, because I have seen people talk about it (but not write it), and I have seen the mod gear in the bottom right.

But, I have tried everything I could find, and cannot for the life of me find a way to actually get access to these folders. But this probably isn’t the place to go into that. Instead, I would like to know how to unpack the files to write a mod. When I try to use the “unpack_assets.exe” it just says I don’t have permission.

rt.representation theory – Making use of extra symmetries; more examples?


In representation theory, it’s nice to decompose a given representation into smaller ones. One technique is by utilizing extra symmetries. Explicit examples come from compact groups, and I wonder if there are more such examples.

Formal description

To be more precise, let $R$ be an associative unital complex algebra and $M$ a finite dimensional left $R$-module. Let further $G$ be a finite group with a complex-linear action on $M$, such that both actions commute. Then any $G$-isotypic component $M_i$ of $M$ is a left $R$-module, yielding a decomposition of $R$-module

$$ M = M_1 oplus ldots oplus M_l.$$

The proof of it lies in the fact that the projection to $chi$‘th $G$-isotypic component is realizable as an element in the group algebra $A = mathbb{C}(G)$

$$ frac{1}{|G|} Sigma_{gin G} overline{chi(g)} g.$$

Examples arise in the field of modular forms (diamond operator.. etc) (1) and geometric representation theory (2, theorem 8.1.16) (classification of the representations of the affine Hecke algebra, extra symmetries from the stabilizer of a chosen point in the nilpotent cone.. etc).

However, this seems to rely on the fact that the projection is realizable as an element. Moreover, the element in this case seems exclusive for topological compact groups.. therefore the questions:


  1. What else algebra $A$ has an element that serves as the projection to a given isotypic component for any of its left modules?

  2. More such examples as in extra compatible symmetries reducing the complexity of certain mathematical object?


  • (1) A First Course in Modular Forms-(Diamond and Shurman)
  • (2) Representation Theory and Complex Geometry-(Chriss and Ginzburg)