Ask Your Question

How to delete several vectors from a vector space?

asked 2021-05-07 14:36:31 +0200

Ycs gravatar image

updated 2021-05-08 16:07:11 +0200

Let V be a vector space. Let E be a specific vectors list where each vector belongs to V.

How to delete vectors in E from the vector space V?

edit retag flag offensive close merge delete


After you delete vectors from V, V will likely no longer be a vector space, so to do this properly, you would need to define a new class, say DeletedVectorSpace, and implement whatever methods you wanted for it. Obviously a vector space over the rationals, for example, does not come equipped with a list of all of its elements, so you can't just delete one; you would need to keep track of the original vector space and the list of vectors deleted from it. So I guess that's the start of an answer: begin with the data (V, E).

John Palmieri gravatar imageJohn Palmieri ( 2021-05-07 19:05:03 +0200 )edit

As John Palmieri pointed out, deleting a vector $V$ from its vector space $S$ is about meaningless.

However, there is a possible meaning : finding a subspace $S'$ of $S$ which does not contain V, i. e. no linear combination of elements of $S$ is equal to $V$. In other words, $S'$ is orthogonal to $V$. Is that what you mean ?

Under this interpretation, your problem is therefore to find $S''$ orthogonal to each of your vectors $V_i$. An immediate example comes to mind : in $\mathbb{R}^3$, $(0, 0, 1)$ is orthogonal to both $(1, 0, 0)$ and $(0, 1, 0)$. So the thing is not in principle impossible.

I hope that this hint is enough to get you started on what looks to be your homework...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2021-05-07 23:37:04 +0200 )edit

Please provide sample input and output, so we have some idea of what you hope to achieve.

John Palmieri gravatar imageJohn Palmieri ( 2021-05-08 17:57:55 +0200 )edit

q = 2 ; m = 229; n = 83; r = 8

Fqm = GF(q^m)

def gen_vec_space(t): # generate a vector space of dimension t over Fqm.

B = matrix(Fqm.base_ring(),t,m,0)

while B.rank() != t:

    B = matrix(Fqm.base_ring(),[vector(Fqm.random_element()) for i in range(t)])

return B.row_space()

E = gen_vec_space(r)

DeleteE = [E.random_element() for i in range(n)]

This a simple example about low-dimension E.

I want to know a universal and efficient code --- how to delete vectors in DeleteE from the vector space E with any dimension r (<m)?< p="">

Ycs gravatar imageYcs ( 2021-05-09 04:10:01 +0200 )edit

You could create a list of all elements in E and then delete some of them, but that's basically impossible: E could be huge, so huge that it would be impossible to list its elements in the first place, let alone have an efficient way of deleting any. (With the example where E is an 8-dimensional vector space over GF(2^229), evaluate E.cardinality() to see how large E is. Since it's more than the number of particles in the universe, we probably can't store it in computer memory.) So again, what are you trying to achieve? What calculations are you hoping to do with E with some vectors deleted? Why can't you perform them by keeping track of E and the list of deleted vectors?

John Palmieri gravatar imageJohn Palmieri ( 2021-05-09 20:08:32 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-05-12 05:28:13 +0200

Something like this could work, but since we don't know what you want to do with the vector space with elements deleted, it's hard to give any specifics.

class DeletedVectorSpace():
    def __init__(self, vector_space, deleted):

        ``vector_space`` -- ambient vector space
        ``deleted`` -- list of vectors to be removed
        self._vector_space = vector_space
        self._deleted = deleted

    def method1(self):
        now do stuff with self._vector_space and self._deleted

    def method2(self):
        now do stuff with self._vector_space and self._deleted

    def method3(self):
        now do stuff with self._vector_space and self._deleted
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-05-07 14:36:31 +0200

Seen: 131 times

Last updated: May 12 '21