How to find double output?
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
 import java.math.*;
>> p=BigInteger('11');
>> m=BigInteger('2');
>> [A,B]=m.gcd(p);
Error using java.math.BigInteger/gcd
Java methods cannot be called with multiple output arguments
How  to resolve this issue? I need both A and B.
Thanking in anticipation
채택된 답변
  Walter Roberson
      
      
 2022년 3월 2일
         import java.math.*;
 p = BigInteger('11');
 m = BigInteger('2');
 A = m.gcd(p)
 B = m.modInverse(p)
m.multiply(B).mod(p)
댓글 수: 3
  Walter Roberson
      
      
 2022년 3월 2일
				 import java.math.*;
 p = BigInteger('11');
 m = BigInteger('2');
 a = inverse(m, p)
 %cross-check
 cross_check = m.multiply(a).mod(p)
function a = inverse(b, p)
    import java.math.*;
    A = b.gcd(p);
    if A == BigInteger('1')
        a = b.modInverse(p);
    else
        a = BigInteger('0');
    end
end
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



