Курицин Сергей on Fri, 25 Apr 2014 13:15:34 +0200


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

factor-like output


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.
On the other hand, matrix() doesn't allow adding values dynamically.
 
Please help.


Best regards,