Re: [ojAlgo-user] power or round functionality
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Argyrouska B. <esp...@gm...> - 2015-04-30 11:47:35
|
Hi again, Would it be easy for you to provide a very simple example? e.g. I have an array and I want to do the pow operation to constant value (let's say 3). So: a[1].pow(3), a[2].pow(3), a[3].pow(3) etc.. thanks again On 29 April 2015 at 01:06, Anders Peterson <an...@op...> wrote: > I think you misinterpret “binary function” > > http://en.wikipedia.org/wiki/Binary_function > > http://ojalgo.org/generated/org/ojalgo/function/BinaryFunction.html > > > Did you bother to look at UnaryFunction, BinaryFunction and the other > interfaces/classed in that package? > > > > On 28 apr 2015, at 23:24, Argyrouska Bob <esp...@gm...> wrote: > > > > Hi, > > > > It seems a little hard to find any examples in the Javadocs. How exactly > you define an exponential operation (not a binary one like XOR ^) using a > BinaryFunction? > > > > Thanks again for your support > > > > On 27 April 2015 at 22:43, Anders Peterson <an...@op...> wrote: > > Rounding can be done using UnaryFunction - just create an instance that > does what you want. The class NumberContext can give you a function that > may suit you. Instantiate a NumberContext and then call get***Function() > > > > There’s also the SCALE function of PrimitiveFunction. When/if you > specify the parameter it turns into a unary function. > > > > I think you should switch from using BasicMatrix to > MatrixStore/PhysicalStore. > > > > For “pow” you need a binary function... > > > > fillMatching(Access1D<? extends Number>) > > fillMatching(Access1D<Double>, BinaryFunction<Double>, Access1D<Double>) > > fillMatching(Access1D<Double>, BinaryFunction<Double>, Double) > > fillMatching(Double, BinaryFunction<Double>, Access1D<Double>) > > > > > > > On 27 apr 2015, at 20:30, Argyrouska Bob <esp...@gm...> wrote: > > > > > > Sorry, > > > > > > Thanks for your prompt reply. > > > Maybe I didn't make myself clear. I was referring to exponential > similar to what native Java Math.pow() does. > > > What I am looking for is: > > > > > > BasicMatrix tA, tB; > > > tA.pow(tB); or tA.pow(2.0); > > > > > > which will eventually lead to tA^x, where x=element from tB (applied > for each element) or a constant value. > > > Secondly a round function similar to what native Java Math.round() > offers. > > > Meaning: > > > > > > BasicMatrix tA; > > > tA.round(RoundindMode); > > > > > > which will result in rounding each element of tA to RoundingMode, > where RoundingMode=FLOOR, CEILING etc > > > Are these possible using UnaryFunctions? > > > > > > Thanks > > > > > > On 27 April 2015 at 20:00, Anders Peterson <an...@op...> > wrote: > > > Sorry, I just noticed you were using BasicMatrix. It works a little > different there (a somewhat limited set of functionality) partly because > BasicMatrix instances are immutable. It does have a modify-method: > > > > > > BasicMatrix modify(UnaryFunction<? extends Number>); > > > > > > > > > > > > > > > > On 27 apr 2015, at 18:51, Anders Peterson <an...@op...> > wrote: > > > > > > > > Do you want to modify matrix elements? > > > > > > > > Everything that implements Access2D.Modifiable has these methods: > > > > > > > > modifyColumn(long, long, UnaryFunction<N>) > > > > modifyDiagonal(long, long, UnaryFunction<N>) > > > > modifyOne(long, long, UnaryFunction<N>) > > > > modifyOne(long, UnaryFunction<N>) > > > > modifyRange(long, long, UnaryFunction<N>) > > > > modifyRow(long, long, UnaryFunction<N>) > > > > > > > > If you’re using primitive double elements you’ll find a predefined > set of functions in org.ojalgo.function.PrimitiveFunction > > > > > > > > The PhysicalStore.Factory also provides access to that set of > functions. > > > > > > > > If you don’t find what you need you just create a custom > UnaryFunction implementation. > > > > > > > > /Anders > > > > > > > > > > > >> On 27 apr 2015, at 18:29, Argyrouska Bob <esp...@gm...> > wrote: > > > >> > > > >> Hello, > > > >> > > > >> I am a new member and still practicing with library but what > surprises me is that I haven't found support for power functions or round > to a BasicMatrix data type. Is this true or it's named somewhat different? > > > >> > > > >> Thanks and regards, > > > >> silver > > > >> > > > >> > > > >> > ------------------------------------------------------------------------------ > > > >> One dashboard for servers and applications across > Physical-Virtual-Cloud > > > >> Widest out-of-the-box monitoring support with 50+ applications > > > >> Performance metrics, stats and reports that give you Actionable > Insights > > > >> Deep dive visibility with transaction tracing using APM Insight. > > > >> > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y_______________________________________________ > > > >> ojAlgo-user mailing list > > > >> ojA...@li... > > > >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > > One dashboard for servers and applications across > Physical-Virtual-Cloud > > > Widest out-of-the-box monitoring support with 50+ applications > > > Performance metrics, stats and reports that give you Actionable > Insights > > > Deep dive visibility with transaction tracing using APM Insight. > > > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > > > _______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > > > > > -- > > > Reality leaves a lot to imagination. > > > > ------------------------------------------------------------------------------ > > > One dashboard for servers and applications across > Physical-Virtual-Cloud > > > Widest out-of-the-box monitoring support with 50+ applications > > > Performance metrics, stats and reports that give you Actionable > Insights > > > Deep dive visibility with transaction tracing using APM Insight. > > > > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y_______________________________________________ > > > ojAlgo-user mailing list > > > ojAlgo-user@lists..sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > ------------------------------------------------------------------------------ > > One dashboard for servers and applications across Physical-Virtual-Cloud > > Widest out-of-the-box monitoring support with 50+ applications > > Performance metrics, stats and reports that give you Actionable Insights > > Deep dive visibility with transaction tracing using APM Insight. > > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > > _______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > > > > > -- > > Reality leaves a lot to imagination. > > > ------------------------------------------------------------------------------ > > One dashboard for servers and applications across Physical-Virtual-Cloud > > Widest out-of-the-box monitoring support with 50+ applications > > Performance metrics, stats and reports that give you Actionable Insights > > Deep dive visibility with transaction tracing using APM Insight. > > > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y_______________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > -- Reality leaves a lot to imagination. |