Changeset d1ea29c in tol
- Timestamp:
- Aug 26, 2009, 9:59:24 AM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- dd43df6
- Parents:
- ce31518
- File:
-
- 1 edited
-
tol/btol/vmatrix_type/vmatgra.cpp (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/vmatrix_type/vmatgra.cpp
rce31518 rd1ea29c 658 658 //-------------------------------------------------------------------- 659 659 DeclareContensClass(BVMat, BVMatTemporary, BVMatZero); 660 DefExtOpr(1, BVMatZero, "Zeros", 1, 2,661 "Real Real ",662 "(Real nrow [, Real ncol=nrow ])",660 DefExtOpr(1, BVMatZero, "Zeros", 1, 3, 661 "Real Real Text", 662 "(Real nrow [, Real ncol=nrow, Text subType=\"Cholmod.R.Sparse\"])", 663 663 I2("Creates a matrix with all elements equal to zero.\n" 664 664 "Allowed subtypes are :\n", … … 673 673 int nrow = (int)Real(Arg(1)); 674 674 int ncol = nrow; 675 if(Arg(2)) { ncol=(int)Real(Arg(2)); } 676 contens_.Zeros(nrow,ncol,BVMat::ESC_chlmRsparse); 675 BVMat::ECode code = BVMat::ESC_chlmRsparse; 676 if(Arg(2)) { ncol = (int)Real(Arg(2)); } 677 if(Arg(3)) { code = BVMat::FindCodeName(Text(Arg(3))); } 678 contens_.Zeros(nrow,ncol,code); 677 679 assert(contens_.Check()); 678 680 } … … 1593 1595 //-------------------------------------------------------------------- 1594 1596 DeclareContensClass(BVMat, BVMatTemporary, BVMatAnd); 1595 DefIntOpr(1, BVMatAnd, "And", 2, 2,1596 "(VMatrix A, VMatrix B )",1597 DefIntOpr(1, BVMatAnd, "And", 2, 0, 1598 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1597 1599 I2("Returns the logical AND of arguments.", 1598 1600 "Devuelve el AND (Y) lógico de los argumentos"), … … 1603 1605 { 1604 1606 BVMat::And(VMat(Arg(1)),VMat(Arg(2)),contens_); 1607 int n = 3; 1608 while(Arg(n)) 1609 { 1610 BVMat aux = contens_; 1611 BVMat::And(aux,VMat(Arg(n)),contens_); 1612 n++; 1613 } 1605 1614 assert(contens_.Check()); 1606 1615 } … … 1608 1617 //-------------------------------------------------------------------- 1609 1618 DeclareContensClass(BVMat, BVMatTemporary, BVMatOr); 1610 DefIntOpr(1, BVMatOr, "Or", 2, 2,1611 "(VMatrix A, VMatrix B )",1619 DefIntOpr(1, BVMatOr, "Or", 2, 0, 1620 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1612 1621 I2("Returns the logical OR of arguments.", 1613 1622 "Devuelve el OR (O) lógico de los argumentos"), … … 1618 1627 { 1619 1628 BVMat::Or(VMat(Arg(1)),VMat(Arg(2)),contens_); 1629 int n = 3; 1630 while(Arg(n)) 1631 { 1632 BVMat aux = contens_; 1633 BVMat::Or(aux,VMat(Arg(n)),contens_); 1634 n++; 1635 } 1620 1636 assert(contens_.Check()); 1621 1637 } … … 1623 1639 //-------------------------------------------------------------------- 1624 1640 DeclareContensClass(BVMat, BVMatTemporary, BVMatEq); 1625 DefIntOpr(1, BVMatEq, "Eq", 2, 2,1626 "(VMatrix A, VMatrix B )",1641 DefIntOpr(1, BVMatEq, "Eq", 2, 0, 1642 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1627 1643 I2("Returns TRUE just in each cell where ", 1628 1644 "Devuelve CIERTO sólo para las celdas para las que ")+ … … 1634 1650 { 1635 1651 BVMat::EQ(VMat(Arg(1)),VMat(Arg(2)),contens_); 1652 int n = 3; 1653 while(Arg(n)) 1654 { 1655 BVMat aux1 = contens_; 1656 BVMat::EQ(VMat(Arg(n-1)),VMat(Arg(n)),contens_); 1657 BVMat aux2 = contens_; 1658 BVMat::And(aux1,aux2,contens_); 1659 n++; 1660 } 1636 1661 assert(contens_.Check()); 1637 1662 } … … 1639 1664 //-------------------------------------------------------------------- 1640 1665 DeclareContensClass(BVMat, BVMatTemporary, BVMatNE); 1641 DefIntOpr(1, BVMatNE, "NE", 2, 2,1642 "(VMatrix A, VMatrix B )",1666 DefIntOpr(1, BVMatNE, "NE", 2, 0, 1667 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1643 1668 I2("Returns TRUE just in each cell where ", 1644 1669 "Devuelve CIERTO sólo para las celdas para las que ")+ … … 1650 1675 { 1651 1676 BVMat::NE(VMat(Arg(1)),VMat(Arg(2)),contens_); 1677 int n = 3; 1678 while(Arg(n)) 1679 { 1680 BVMat aux1 = contens_; 1681 BVMat::NE(VMat(Arg(n-1)),VMat(Arg(n)),contens_); 1682 BVMat aux2 = contens_; 1683 BVMat::And(aux1,aux2,contens_); 1684 n++; 1685 } 1652 1686 assert(contens_.Check()); 1653 1687 } … … 1655 1689 //-------------------------------------------------------------------- 1656 1690 DeclareContensClass(BVMat, BVMatTemporary, BVMatLE); 1657 DefIntOpr(1, BVMatLE, "LE", 2, 2,1658 "(VMatrix A, VMatrix B )",1691 DefIntOpr(1, BVMatLE, "LE", 2, 0, 1692 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1659 1693 I2("Returns TRUE just in each cell where ", 1660 1694 "Devuelve CIERTO sólo para las celdas para las que ")+ … … 1666 1700 { 1667 1701 BVMat::LE(VMat(Arg(1)),VMat(Arg(2)),contens_); 1702 int n = 3; 1703 while(Arg(n)) 1704 { 1705 BVMat aux1 = contens_; 1706 BVMat::LE(VMat(Arg(n-1)),VMat(Arg(n)),contens_); 1707 BVMat aux2 = contens_; 1708 BVMat::And(aux1,aux2,contens_); 1709 n++; 1710 } 1668 1711 assert(contens_.Check()); 1669 1712 } … … 1671 1714 //-------------------------------------------------------------------- 1672 1715 DeclareContensClass(BVMat, BVMatTemporary, BVMatLT); 1673 DefIntOpr(1, BVMatLT, "LT", 2, 2,1674 "(VMatrix A, VMatrix B )",1716 DefIntOpr(1, BVMatLT, "LT", 2, 0, 1717 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1675 1718 I2("Returns TRUE just in each cell where ", 1676 1719 "Devuelve CIERTO sólo para las celdas para las que ")+ … … 1682 1725 { 1683 1726 BVMat::LT(VMat(Arg(1)),VMat(Arg(2)),contens_); 1727 int n = 3; 1728 while(Arg(n)) 1729 { 1730 BVMat aux1 = contens_; 1731 BVMat::LT(VMat(Arg(n-1)),VMat(Arg(n)),contens_); 1732 BVMat aux2 = contens_; 1733 BVMat::And(aux1,aux2,contens_); 1734 n++; 1735 } 1684 1736 assert(contens_.Check()); 1685 1737 } … … 1687 1739 //-------------------------------------------------------------------- 1688 1740 DeclareContensClass(BVMat, BVMatTemporary, BVMatGE); 1689 DefIntOpr(1, BVMatGE, "GE", 2, 2,1690 "(VMatrix A, VMatrix B )",1741 DefIntOpr(1, BVMatGE, "GE", 2, 0, 1742 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1691 1743 I2("Returns TRUE just in each cell where ", 1692 1744 "Devuelve CIERTO sólo para las celdas para las que ")+ … … 1698 1750 { 1699 1751 BVMat::GE(VMat(Arg(1)),VMat(Arg(2)),contens_); 1752 int n = 3; 1753 while(Arg(n)) 1754 { 1755 BVMat aux1 = contens_; 1756 BVMat::GE(VMat(Arg(n-1)),VMat(Arg(n)),contens_); 1757 BVMat aux2 = contens_; 1758 BVMat::And(aux1,aux2,contens_); 1759 n++; 1760 } 1700 1761 assert(contens_.Check()); 1701 1762 } … … 1703 1764 //-------------------------------------------------------------------- 1704 1765 DeclareContensClass(BVMat, BVMatTemporary, BVMatGT); 1705 DefIntOpr(1, BVMatGT, "GT", 2, 2,1706 "(VMatrix A, VMatrix B )",1766 DefIntOpr(1, BVMatGT, "GT", 2, 0, 1767 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1707 1768 I2("Returns TRUE just in each cell where ", 1708 1769 "Devuelve CIERTO sólo para las celdas para las que ")+ … … 1714 1775 { 1715 1776 BVMat::GT(VMat(Arg(1)),VMat(Arg(2)),contens_); 1777 int n = 3; 1778 while(Arg(n)) 1779 { 1780 BVMat aux1 = contens_; 1781 BVMat::GT(VMat(Arg(n-1)),VMat(Arg(n)),contens_); 1782 BVMat aux2 = contens_; 1783 BVMat::And(aux1,aux2,contens_); 1784 n++; 1785 } 1716 1786 assert(contens_.Check()); 1717 1787 } … … 1719 1789 //-------------------------------------------------------------------- 1720 1790 DeclareContensClass(BVMat, BVMatTemporary, BVMatMin); 1721 DefIntOpr(1, BVMatMin, "Min", 2, 2,1722 "(VMatrix A, VMatrix B )",1791 DefIntOpr(1, BVMatMin, "Min", 2, 0, 1792 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1723 1793 I2("Returns in each cell the minimum value of arguments ", 1724 1794 "Devuelve en cada celda el mínimo de los argumentos ")+ … … 1730 1800 { 1731 1801 BVMat::Min(VMat(Arg(1)),VMat(Arg(2)),contens_); 1802 int n = 3; 1803 while(Arg(n)) 1804 { 1805 BVMat aux = contens_; 1806 BVMat::Min(aux,VMat(Arg(n)),contens_); 1807 n++; 1808 } 1732 1809 assert(contens_.Check()); 1733 1810 } … … 1735 1812 //-------------------------------------------------------------------- 1736 1813 DeclareContensClass(BVMat, BVMatTemporary, BVMatMax); 1737 DefIntOpr(1, BVMatMax, "Max", 2, 2,1738 "(VMatrix A, VMatrix B )",1814 DefIntOpr(1, BVMatMax, "Max", 2, 0, 1815 "(VMatrix A, VMatrix B [, VMatrix C, ...])", 1739 1816 I2("Returns in each cell the maximum value of arguments ", 1740 1817 "Devuelve en cada celda el máximo de los argumentos ")+ … … 1746 1823 { 1747 1824 BVMat::Max(VMat(Arg(1)),VMat(Arg(2)),contens_); 1748 assert(contens_.Check()); 1825 int n = 3; 1826 while(Arg(n)) 1827 { 1828 BVMat aux = contens_; 1829 BVMat::Max(aux,VMat(Arg(n)),contens_); 1830 n++; 1831 } 1832 assert(contens_.Check()); 1833 } 1834 1835 //-------------------------------------------------------------------- 1836 DeclareContensClass(BVMat, BVMatTemporary, BVMatIfVMatReal); 1837 DefExtOpr(1, BVMatIfVMatReal, "IfVMat", 3, 3, "VMatrix VMatrix VMatrix", 1838 "(VMatrix condition, VMatrix A, VMatrix B)", 1839 I2("For each cell (i,j) if condition(i,j) is true returns the value of A(i,j), else B(i,j).", 1840 "Para cada celda (i,j) si condition(i,j) es cierto devuelve A(i,j) y si no B(i,j)."), 1841 BOperClassify::MatrixAlgebra_); 1842 //-------------------------------------------------------------------- 1843 void BVMatIfVMatReal::CalcContens() 1844 //-------------------------------------------------------------------- 1845 { 1846 BVMat& C = VMat(Arg(1)); 1847 BVMat& A = VMat(Arg(2)); 1848 BVMat& B = VMat(Arg(3)); 1849 BVMat::If(C,A,B,contens_); 1749 1850 } 1750 1851 … … 1796 1897 if(Arg(2)) { S=Text(Arg(2)); } 1797 1898 if(Arg(3)) { force=Real(Arg(3))!=0.0; } 1798 1799 BVMat::CholeskiFactor(VMat(Arg(1)),contens_,S,true,force); 1899 if(Arg(1)->LocalName()=="X") 1900 printf(""); 1901 BVMat& X = VMat(Arg(1)); 1902 BVMat::CholeskiFactor(X,contens_,S,true,force); 1800 1903 assert(contens_.Check()); 1801 1904 }
Note: See TracChangeset
for help on using the changeset viewer.
