Bill Allombert on Fri, 25 Apr 2014 13:33:27 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 Re: factor-like output

```On Fri, Apr 25, 2014 at 11:15:20AM +0000, Курицин Сергей wrote:
> Hello!
>
> I wrote a function for factorization of binomial coefficients. I want it to output result as t_MAT, just like factor().
> And I can't figure out how to make it.
> My code uses forprime for primes in some range and determines exponents of prime factors. Then it stores prime and its exponent as a vector, which I intend to append to resulting factorization matrix:
> (pseudocode)
>
> factors=Mat;
> forprime(p=a,b,
>    \\ ... there goes the logic of checking prime and determination of its exponent
>    v = [p, p_e];
>    factors.append(v)
> );
> return factors;
>
>
> I need to add vector rows to matrix dynamically, but if I make something like that:
>
>     m=Mat
>     v1=[1, 2]
>     v2=[3, 4]
>     m=matconcat(v1)
>     m=matconcat(v2),
>
> m becomes [3, 4], missing first vector.

You should do
m=matconcat([m,v1]~)
m=matconcat([m,v2]~)

Cheers,
Bill.

```

• References: